Jsforce: Ability to add additional headers like 'Sforce-Query-Options'

Created on 31 Jul 2015  路  2Comments  路  Source: jsforce/jsforce

Seeing that the 'Sforce-Call-Options' header can now be added optionally with jsforce it would be great to also allow for the 'Sforce-Query-Options' to be able to limit the batch size - I know Salesforce does not guarantee to stick to the batch size, but in my testing most of the time they do return the number of records asked for, which helps a lot.

It could be added similarly as the callOptions in beforeSend I guess, happy to do a PR if it makes sense to add this functionality.

enhancement

Most helpful comment

Sorry to reopen the issue, but it doesn't work.
I have added queryOptions: {"Sforce-Query-Options": "batchSize=200"} to the connection options, and it doesn't work, I get a "sforce-query-options" is not a valid header or something of the sort.
After looking at the commit, and reading the documentation, the query options should be set on the query resource, and according to the code in the commit, the queryOptions are not transferred to the query object.

Although, I did manage to find a workaround, by setting the options.headers of the query object like so:
query.execute({headers: {"Sforce-Query-Options": "batchSize=200"}}, callback);

Unless I used the queryOptions the wrong way, I would suggest to assign the queryOptions, to the options.headers in the query object to fix the issue.

All 2 comments

Sorry I'm new to development and reading documentation. Can you help point me to where I can manually update the header info before a request is set?

Sorry to reopen the issue, but it doesn't work.
I have added queryOptions: {"Sforce-Query-Options": "batchSize=200"} to the connection options, and it doesn't work, I get a "sforce-query-options" is not a valid header or something of the sort.
After looking at the commit, and reading the documentation, the query options should be set on the query resource, and according to the code in the commit, the queryOptions are not transferred to the query object.

Although, I did manage to find a workaround, by setting the options.headers of the query object like so:
query.execute({headers: {"Sforce-Query-Options": "batchSize=200"}}, callback);

Unless I used the queryOptions the wrong way, I would suggest to assign the queryOptions, to the options.headers in the query object to fix the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JonDum picture JonDum  路  7Comments

fearphage picture fearphage  路  4Comments

MGarfOppLoans picture MGarfOppLoans  路  7Comments

twojoke picture twojoke  路  5Comments

rogah picture rogah  路  8Comments