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

More detail needed on setting HTTP headers #414

Open
lukewlms opened this issue Jul 19, 2022 · 1 comment
Open

More detail needed on setting HTTP headers #414

lukewlms opened this issue Jul 19, 2022 · 1 comment

Comments

@lukewlms
Copy link

lukewlms commented Jul 19, 2022

I've read #186, but I'm still having trouble setting a header. I've created an httpClient but how do I "pass it in" here, is this supported?

As soon as I add this code (including without any header set), I get an error like this, which makes it seem like passing in the HTTP Header isn't working at all:

value": "

System.AggregateException: One or more errors occurred. (Unexpected character encountered while parsing value: <. Path '', line 0, position 0.)\n ---> Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.\n   at

(My ultimate goal is to enable field truncation for a request, so we don't need to custom truncate every single field at the perfect length, per https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_header_allowfieldtruncation.htm.)

Here's the code. Note that I'm not sure this is the right header naming for this option, I haven't found SF documentation for setting it via HTTP:

    var httpClient = new HttpClient();
    httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Allow-Field-Truncation", "true");

    var client = new ForceClient(
      instanceUrl: auth.InstanceUrl,
      accessToken: auth.AccessToken,
      apiVersion: auth.ApiVersion,
      httpClient,
      httpClient
    );

(It looks like part of the issue I'm facing, at least, is the same as: #377)

@muenzpraeger
Copy link

I'm not familiar with .NETet al, but this library seems to only support the REST APIs.

The mentioned AllowFieldTruncationHeader is a SOAP header (as you linked), not a HTTP header.

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

No branches or pull requests

2 participants