• http.js

    From Kirkman@VERT/GUARDIAN to All on Fri Feb 28 11:52:32 2014
    Does http.js allow for customization of the headers sent in a request?

    I'm playing around with parsing some json apis, and some of them require that you add a header of the form "Bearer " + token.

    --Josh

    ////--------------------------------------------------
    BiC -=- http://breakintochat.com -=- bbs wiki and blog


    ---
    ■ Synchronet
  • From Deuce@VERT/SYNCNIX to Kirkman on Sat Mar 1 14:14:39 2014
    Re: http.js
    By: Kirkman to All on Fri Feb 28 2014 12:52 pm

    Does http.js allow for customization of the headers sent in a request?

    Absolutely, you need to create the request, modify it, then send it like so:

    req = new HTTPRequest();
    req.SetupGet("http://example.com");
    req.request_headers.push("X-Magic: More magic");
    req.SendRequest();
    req.ReadResponse();
    response = req.body;

    Have a look at the Get() method in http.js for how to do auth and such.

    ---
    http://DuckDuckGo.com/ a better search engine that respects your privacy.
    ■ Synchronet ■ My Brand-New BBS (All the cool SysOps run STOCK!)
  • From Kirkman@VERT/GUARDIAN to Deuce on Sat Mar 1 17:21:14 2014
    Re: http.js
    By: Deuce to Kirkman on Sat Mar 01 2014 03:14 pm

    Absolutely, you need to create the request, modify it, then send it like
    so:

    req = new HTTPRequest();
    req.SetupGet("http://example.com");
    req.request_headers.push("X-Magic: More magic");

    Awesome. That sounds like exactly what I need!

    --Josh


    ////--------------------------------------------------
    BiC -=- http://breakintochat.com -=- bbs wiki and blog


    ---
    ■ Synchronet