Skip to content

Commit

Permalink
feat: add options command, example with coap.me
Browse files Browse the repository at this point in the history
Signed-off-by: 1998-felix <[email protected]>
  • Loading branch information
felixgateru committed May 23, 2024
1 parent 4940a67 commit 1a2256f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
40 changes: 40 additions & 0 deletions examples/coapme/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
host="coap.me"
port="5683"
testPath="/test"
largePath="/large"
etagPath="/etag"
payload="Hello world from absmach/coap-cli"

#Get
echo "Sending GET request to $host:$port$testPath"
coap-cli get $testPath -H $host -p $port
sleep 1

#Get with blockwise transfer
echo "Sending GET request with blockwise transfer to $host:$port$testPath"
coap-cli get $largePath -H $host -p $port
sleep 1

#Post
echo "Sending POST request to $host:$port$testPath"
coap-cli post $testPath -H $host -p $port -d $payload
sleep 1

#Post with content format
echo "Sending POST request with content format to $host:$port$testPath"
coap-cli post $testPath -H $host -p $port -d $payload -c 50
sleep 1

#Post with authentication
echo "Sending POST request with authentication to $host:$port$testPath"
coap-cli post $testPath -H $host -p $port -d $payload --auth "test"
sleep 1

#Put
echo "Sending PUT request to $host:$port$testPath"
coap-cli put $testPath -H $host -p $port -d $payload
sleep 1

#Delete
echo "Sending DELETE request to $host:$port$testPath"
coap-cli delete $testPath -H $host -p $port
6 changes: 6 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ require (
github.com/spf13/cobra v1.8.0
)

require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
)

require (
github.com/dsnet/golib/memfile v1.0.0 // indirect
github.com/fatih/color v1.16.0
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand Down

0 comments on commit 1a2256f

Please sign in to comment.