JSON request dispatcher

[io/http/JSON request dispatcher]


Dispatches HTTP request, expects response as JSON, parses it and outputs it as data. Outputs error if failed. More: https://github.com/Cranq-io/cranq-tutorials/tree/main/http_request


Keywords: get, post, put, patch, delete, fetch, api, json, data

Input ports

  • JSON req.:

    {
      "method": ("GET" or "POST" or "PUT" or "PATCH" or "DELETE"),
      "url": string,
      "headers": {string: string},
      optional "data": any
    }

    Receives request with JSON body.

Output ports

  • data: any

    Sends HTTP response message body as data. Example: { "userId": 1, "id": 1, "title": "delectus aut autem", "completed": false }"

  • response:

    {"status": number, "headers": {string: any}, "body": string}

    Sends original response.

  • error: {"error": string}

Last updated