Using the SPHttpClient should work as described in the release notes.
When trying to use the SPHttpClient passing SPHttpClientConfigurations.v1 as the configuration, the browser throws an error Cannot read property 'v1' of undefined.
import { SPHttpClientConfigurations } from '@microsoft/sp-http';this.context.spHttpClient.get('/_api/web', SPHttpClientConfigurations.v1);$ gulp serve --nobrowserI got this in a couple of tenants as well. Is it that the RC0 bits haven't fully landed in all the tenants yet?
Worked fine on other tenants.
It turns out it's due to a typo in the documentation (that has been fixed). The correct usage is:
import { SPHttpClient } from '@microsoft/sp-http';
this.context.spHttpClient.get('/_api/web', SPHttpClient.configurations.v1);
This one is interesting. @VesaJuvonen I see you have made the edit to the docs. Could we get more info on which method of specifying the config is recommened? As @pgonzal has recommened using SPHttpClientConfigurations.v1 here https://github.com/SharePoint/sp-dev-docs/issues/44
When writing new code, our intent is for you to always specify the most recent version (i.e. "v" followed by the largest integer that is defined). This should give you all the recommended features, and disable any deprecated features.
When reusing code, e.g. copying snippets from the internet, you should not change the version number unless you are explicitly doing the work to migrate/retest the code.
That is the main reason why we introduced these configurations. (You can also use overrideWith() to customize the configuration, but personally I believe that is a rare edge case. In most cases you can achieve what you need by using the normal options.)
thanks in advance
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues
Most helpful comment
It turns out it's due to a typo in the documentation (that has been fixed). The correct usage is: