Request dispatcher
Last updated
Last updated
[io/http/Request dispatcher]
Dispatches HTTP request and outputs response or error. More: https://github.com/Cranq-io/cranq-tutorials/tree/main/http_request
Keywords: get, post, put, patch, delete, fetch, api
request:
Receives parameters of the HTTP request. Example: { "verb":"GET, "url": "https://jsonplaceholder.typicode.com/todos/1", "headers": { "content-type": "application/json; charset=utf-8" } }
response:
Sends HTTP response object. Example: { "status": 200, "headers": { "content-type": "application/json; charset=utf-8", "cache-control": "max-age=43200" }, "body": "{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false }" }
error: {"error": string}
Sends error on failing to send or receive the request. Example: { "error": "Error: getaddrinfo ENOTFOUND x.y" }