Skip to content

Instantly share code, notes, and snippets.



Created Aug 15, 2018
What would you like to do?
Running `shakedown` HTTP unit tests through `import`
#!/usr/bin/env bash
eval "`curl -sfLS`"
import "" # load the framework
shakedown GET /foo # make a GET request
status 404 # assert on http status code
content_type 'text/html' # assert Content-Type header contains string
contains 'Not found' # assert body contains string
matches 'No.*' # assert body matches regex
shakedown HEAD / # make a HEAD request
status 302
shakedown GET / -H 'Accept: application/json' # add curl options
print_headers # output response headers for debugging
print_body # output response body for debugging
status 200
header 'Expires'
shakedown PUT /user/1 -d name=Rob # make a PUT request
status 201
shakedown GET -L # provide full url to override default base url.
status 200 # -L cURL option to follow redirects
shakedown GET
header_contains 'Referrer-Policy' 'no-referrer' # assert header 'Referrer-Policy' contains value 'no-referrer'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment