Hi,
I'm hitting my sharepoint online site, to add files to the 'Shared Documents' list.
Trying from postman, I can get the access token (https://accounts.accesscontrol.windows.net/xxxxxxx-xxxx-xxxxx-xxxxx-xxxxxxxx/tokens/OAuth/2) and also add file to Sharepoint successfully (_api/web/getfolderbyserverrelativeurl('Shared Documents')/Files/add(overwrite=true, url='myfile.json').
But, we have a api gateway here, and when it receive our requests, it add a Transfer-Encoding:chunked Header to the target (Sharepoint in this case). It is a rule from our api gateway.
So, If I try send by postman, for example, a request (either token or add file) with Transfer-Encoding:chunked Header, I'm getting http 500, with body (application/json;odata=nometadata):
{
"odata.error": {
"code": "-1, System.IO.IOException",
"message": {
"lang": "en-US",
"value": "I/O error occurred."
}
}
}
My Request:
POST mySPsite/_api/web/getfolderbyserverrelativeurl('Shared Documents')/Files/add(overwrite=true, url='myfile.json')
Content-Type: application/json
Authorization: Bearer 'mytokendata'
Accept: application/json;odata=nometadata
Transfer-Encoding: chunked
User-Agent: PostmanRuntime/7.13.0
Cache-Control: no-cache
Postman-Token: cf5b880a-159e-4570-aff6-a357c3ead08d
Host: mySPHost
Connection: keep-alive
My Response:
HTTP/1.1 500
status: 500
Cache-Control: private, max-age=0
Transfer-Encoding: chunked
Content-Type: application/json;odata=nometadata;streaming=true;charset=utf-8
Expires: Wed, 30 Jun 2021 16:04:52 GMT
Last-Modified: Thu, 15 Jul 2021 16:04:52 GMT
Vary: Origin
P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
X-SharePointHealthScore: 0
X-SP-SERVERSTATE: ReadOnly=0
DATASERVICEVERSION: 3.0
SPClientServiceRequestDuration: 30
X-AspNet-Version: 4.0.30319
SPRequestGuid: xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
request-id: xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
MS-CV: xxxxxxxxxxxxxo/dBHw.0
Strict-Transport-Security: max-age=31536000
X-FRAME-OPTIONS: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com *.powerapps.com *.yammer.com *.officeapps.live.com *.office.com *.stream.azure-test.net *.microsoftstream.com;
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 16.0.0.21430
X-Content-Type-Options: nosniff
X-MS-InvokeApp: 1; RequireReadOnly
X-Cache: CONFIG_NOCACHE
X-MSEdge-Ref: Ref A: xxxxxxxxxxxxxxxxxxxxxx Ref B: xxxxxxxxxxx Ref C: 2021-07-15T16:04:52Z
Date: Thu, 15 Jul 2021 16:04:51 GMT
How can I deal with Transfer-Encoding:chunked? Is there a solution for this case?