Skip to content

72sevenzy2/req-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

170 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pre-requisites: make sure you have go installed:

go -v

or:

go --v


(project only supports post/get requests for now, but will extend later on).


get started:

setting headers while testing:

go run . [-H key:value] [URL]

testing post/get requests:

go run . [-x POST/GET] [URL]


with streaming enabled: (streaming gives live response data back.)

go run . [-H key:value] [-stream true/false] [URL]

(important to note that you can include 1 of many flags while testing aswell, but make sure to always include the URL at the end).


include response body logging:

go run . [-b true/false -s 1024] [URL]

(important to note you can set a limit on the response body size to log (positive values only), as with the -s flag, if you want it to be the default (1024), simply do not include the flag).


session mode:

Instead of manually pasting, you can enter session mode to dynamically store urls, headers, etc in a variable and then use that variable to test API's (in which the variable will hold the header/url etc).


to enter session mode, run the following:

go run . [-session true/false]

when entering session mode, the url does not need to be present at the end.


session mode tutorial:

start off by setting a variable to hold a url/header or such.

VAR [VarName] [Value]

and to retrieve a variable:

GET [VarName]

and it returns the value of whatever the variable stores.

to delete a variable, run:

DEL [VarName]

to see all stored variables:

FETCH

view all available commands whilst your in session mode:

HELP


using the variables you stored for API testing:

(for standard get requests):

TEST [VarName]

if you a custom header aswell, do so in the following format:

TEST [VarName] [-h headerName:value]

you can also make POST/GET requests as so:

TEST [VarName] [-x GET]

and post request like so:

TEST [VarName] [-x POST -D [bodyData]]

for post requests, when setting a request body you can do -F for form related data, or -D for normal json data as shown above, you can use the -F flag like so:

TEST [VarName] [-x POST -F [title:value]]


and finally, to exit:

EXIT


and make sure you use the exact format as shown, (title:value).

also important, you can include multiple flag options at once when testing (except -F and -D for -x POST).

important to note, VarName should be a variable assigned with a valid url, however for the purpose of session mode, you can store headers/body data/urls in variables to utilise them when running the TEST cmd.

About

curl-like tool built in go for API testing, includes features such as setting custom headers, streaming and such.

Topics

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages