diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -21,21 +21,19 @@ Anything written to a scripts stdout will be treated as part of the HTTP Respons Therefore the first things returned will be treated as headers. To stop reading headers, print a `\n` to stdout to tell the HTTP Response that the headers have ended. -All content after the headers will be treated as the response body, and the scripts exit code will be treated as the http response code. +All content after the headers will be treated as the response body, and if the Status header is given, it will be treated as the http response code. -An example script that gives custom headers is shown below: +An example script that gives custom headers (with res code) is shown below: ```sh #!/bin/bash # print headers that will be returned printf "Content-Type: text/plain\n" printf "aaaaaaaa: AAAAAAAAAA\n" +printf "Status: 418\n" # return 418 im a teapot printf "\n" printf "joe\n" - -# return http code 200 -exit 200 ``` Finally if you wish to read the request body given by the user, that is always stored in stdin. For example to create a echo endpoint: @@ -48,8 +46,6 @@ printf "\n" # the body of any http request made will be stored in stdin cat - -exit 200 ``` ## License |