Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Update to support config of headers sent in requests (issue #125) #127

Merged
merged 2 commits into from
Jun 13, 2016
Merged

Update to support config of headers sent in requests (issue #125) #127

merged 2 commits into from
Jun 13, 2016

Conversation

patrick-rodgers
Copy link
Contributor

Q A
Bug fix? Yes
New feature? Yes
New sample? No
Related issues? fixes #125

What's in this Pull Request?

This PR contains an update to provide global configuration of the headers sent with each REST request. This resolves #125 by allowing a developer to set "application/json; odata=verbose" for the accept header as shown below:

    pnp.setup({
        headers: {
            "Accept": "application/json; odata=verbose"
        }
    });

    pnp.sp.web.get().then(show);

This also enables the scenario of setting an authentication header using a previously retrieved bearer token - or any other headers that may be needed for a given solution. Currently "headers" is the only configurable property but we will add additional configuration options as they become required or found to provide some benefit.

@patrick-rodgers patrick-rodgers merged commit 1aed210 into SharePoint:dev Jun 13, 2016
@patrick-rodgers patrick-rodgers deleted the lib-config branch June 13, 2016 16:25
@patrick-rodgers patrick-rodgers restored the lib-config branch June 13, 2016 16:26
@patrick-rodgers patrick-rodgers deleted the lib-config branch June 14, 2016 13:11
@hariberry
Copy link

In the current version it is:

pnp.setup({
    sp: {
        headers: {
            "Accept": "application/json; odata=verbose"
        }
    }
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants