banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for version 1.0.0.

Examples

banshee/examples-collection/examples/protocols/

http-get-headers

Example: http.get with headers=, and the headers of the answer; an API that answers JSON.

  • example
  • protocol
  • http
  • headers

by banshee1 installation1 version

v1Latest

Published on October 27, 2026. First version in this collection.

Protocol: http.get with headers

headers= sends headers with the request; $answer['headers'] holds those of the answer. Here, the collector asks an API for JSON and checks that it answers in JSON.

How to read it

  • headers=array('Accept' => 'application/json', 'Cache-Control' => 'no-cache'): a name and a value per header, sent as written. A header written in the call wins over the one banshee would send (User-Agent).
  • In the answer, each header name is in lowercase: content-type, whatever the server wrote. A header sent twice by the server comes as one value, joined by , .
  • text.split($type, ';') cuts application/json; charset=utf-8 at the ;, and text.trim takes the blanks off.
  • headers= is a named argument: it comes after the address, as errors=, user= and password= do, in any order.

To adapt it

  • Read another header: location for a redirection, last-modified, x-ratelimit-remaining.
  • A token in a header: headers=array('Authorization' => 'Bearer ' . $token) (see examples/api/backup-jobs).