0.2.4 • Published 7 years ago

toki-method-http v0.2.4

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

toki-method-http

Toki method for making HTTP requests

This is a toki method for making http requests. It supports any valid http method, custom payloads to the endpoint, and custom responses both back to the toki context and if desired, to the originally requesting client.

Lead Maintainer: Derrick Hinkle

Example

{
    name: 'my-action-name' //name your action
    inputConfiguration: { //configuration for making our request
        url: 'http://target/path' //target URL
        passThroughHeaders: true //true if we want to pass all incoming request headers along, or an array of the ones we want to pass
        headers: {'X-Authorization': 'Bearer MyApiKey'} //headers to add
        payload: true //pass along the incoming request body? Template literals are also acceptable
        method: 'post' //any valid http method
        type: 'json' //JSON is default
    }
    clientResponseConfiguration: //any valid template or literal to give back to the client, true to return the output of the request unmodified
}

More examples can be found in the examples document and the full api in the API documentation.

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.0.1

7 years ago