From bdd87a4d54703b8f6e3844afd32ba88926e68d58 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sun, 2 Jul 2023 23:44:48 -0400 Subject: status header --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'README.md') 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 -- cgit v1.2.3-freya