Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing verbose JSON #3015

Closed
futurliberta opened this issue Apr 24, 2024 · 3 comments
Closed

Parsing verbose JSON #3015

futurliberta opened this issue Apr 24, 2024 · 3 comments

Comments

@futurliberta
Copy link

What version of PnPjs library you are using

4.x

Minor Version Number

1.0

Target environment

SharePoint Framework

Additional environment details

In browser

Question/Request

Hi,

I'm using pnpjs in the browser. My SP version is 2013 (can't upgrade...) and i have to use verbose JSON (only type supported in my version)

so, i injected this header in my config :

export const sp = spfi('/test').using(
  SPBrowser({
    baseUrl: '/test',
  }),
  Caching(),
  InjectHeaders({
    accept: 'application/json;odata=verbose',
  }),
).using(PnPLogging(LogLevel.Verbose));

But the JSON responses are wrapped into a d: like this :

{
    "GetContextWebInformation": {
        "__metadata": {
            "type": "SP.ContextWebInformation"
        },
        "FormDigestTimeoutSeconds": 1800,
        "FormDigestValue": "..........",
        "LibraryVersion": "15.0.5545.1000",
        "SiteFullUrl": ".............",
        "SupportedSchemaVersions": {
            "__metadata": {
                "type": "Collection(Edm.String)"
            },
            "results": [
                "14.0.0.0",
                "15.0.0.0"
            ]
        },
        "WebFullUrl": "..............."
    }
}

And it looks like the parser didn't expect this cause when i post data, the digest inserted is undefined.

image

Any way to fix it without writing my own behavior ?

The problem is here if it can help :

image

@patrick-rodgers
Copy link
Member

You'd need your own behavior at this point. If you do something, please share it for https://pnp.github.io/pnpjs/core/behavior-recipes/.

@juliemturner
Copy link
Collaborator

I'm going to close this issue as answered. If you have further issues, please feel free to create a new issue and reference this one.

Copy link

github-actions bot commented Jun 1, 2024

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants