summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorTyler Murphy <tylerm@tylerm.dev>2023-07-02 23:44:48 -0400
committerTyler Murphy <tylerm@tylerm.dev>2023-07-02 23:44:48 -0400
commitbdd87a4d54703b8f6e3844afd32ba88926e68d58 (patch)
tree33bc98f3e1822cbb659cd8f31f59f78fad4b9338 /README.md
parentmove body to stdin (diff)
downloadbashttp-bdd87a4d54703b8f6e3844afd32ba88926e68d58.tar.gz
bashttp-bdd87a4d54703b8f6e3844afd32ba88926e68d58.tar.bz2
bashttp-bdd87a4d54703b8f6e3844afd32ba88926e68d58.zip
status header
Diffstat (limited to 'README.md')
-rw-r--r--README.md10
1 files changed, 3 insertions, 7 deletions
diff --git a/README.md b/README.md
index e6b7580..d66fa32 100644
--- a/README.md
+++ b/README.md
@@ -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