REST Client Header Support

The following JadeRestRequest class constants and methods enable you to add, modify, remove, and view the headers that are to be sent in a REST request.

  • The special forbidden headers that cannot be modified are listed at:

    https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name

    The following method is an example of adding a header that is to be sent in a REST request.

    sendBasicAuthExample();
    vars
        client : JadeRestClient;
        request : JadeRestRequest;
        response : JadeRestResponse;
        base64EncodedCreds : String;
    begin
        client := create JadeRestClient("http://localhost/JadeRestSite/jadehttp.dll");
        request := create JadeRestRequest('headers');
        base64EncodedCreds := 
                "ThisIsNotARealUsername:ThisIsNotARealPassword".Binary.base64Encode();
        request.addHeader("Authorization", "Basic " & base64EncodedCreds);
        write request.getAllHeaders();
    /* Authorization: Basic 
             VABoAGkAcwBJAHMATgBvAHQAQQBSAGUAYQBsAFUAcwBlAHIAbgBhAG0AZQA6AFQAa
             ABpAHMASQBzAE4AbwB0AEEAUgBlAGEAbABQAGEAcwBzAHcAbwByAGQA */
        create response;
        client.get(request, response);
    epilog
        delete client;
        delete request;
        delete response;
    end;

    2022.0.01 and higher