Files
main.tsmain
What you'll learn
- Name the parts of an HTTP request (method, path, query, headers, body) and of a response (status, headers, body)
- Read each part of a request in Hono, and tell an absent header from an empty one
- Set a response's headers and body, and see that a HEAD request gets the headers without the body
Press Run tests to start the app. Its log appears here.Graded endpoints
The route the starter already has: status 200 and a text body
Method, path and every query parameter, as strings; a GET carries no body and no content-type, so body is "" and contentType is null
The body arrives as text; content-type is the only thing saying it is JSON
A body does not have to be JSON: this one is plain text, and says so
No query, no headers, no body: the absent headers are null, not missing keys
A query parameter read into a text body, with the two response headers the task asks for
Without the parameter the greeting has a default, and the same headers
The same headers a GET would get and no body, answered by the GET route with nothing extra written