【发布时间】:2020-09-07 14:32:22
【问题描述】:
我正在尝试从一个简单的网页向 SharePoint 服务器发布一个 http 帖子。 此请求已在 Internet Explorer 上运行,但在 Chrome 上失败。
$.ajax({
url:"http://redacted/_vti_bin/cellstorage.svc/CellStorageService",
type:'POST',
headers:{
'MIME-Version': "1.0",
'SOAPAction': "http://schemas.microsoft.com/sharepoint/soap/ICellStorages/ExecuteCellStorageRequest",
'Content-Type': "multipart/related; type=\"application/xop+xml\"; boundary=\"urn:uuid:8cfcbb22-dd52-4889-b29d-9ff2dcf909b2\"; start=\"<f13ad06d-8530-4af1-8cf3-d6d75c1635d4@tempuri.org>\"; start-Info=\"text/xml; charset=utf-8\"",
'X-Vermeer-Content-Type': "application/x-www-form-urlencoded"
},
我的测试表明,除非请求标头大小写保持不变,否则我正在联系的 Web 服务 (/_vti_bin/cellstorage.svc/CellStorageService) 将失败:
内容类型:多部分/相关;类型=“应用程序/xop+xml”; 边界="urn:uuid:8cfcbb22-dd52-4889-b29d-9ff2dcf909b2"; start="f13ad06d-8530-4af1-8cf3-d6d75c1635d4@tempuri.org"; start-Info="text/xml; charset=utf-8"
但是,Chrome 似乎会自动将请求标头值从“utf-8”转换为“UTF-8”,这可以通过 fiddler 输出来确认。这会导致错误:
POST http://redacted/_vti_bin/cellstorage.svc/CellStorageService 400 (错误请求)
内容类型:多部分/相关;类型=“应用程序/xop+xml”; 边界="urn:uuid:8cfcbb22-dd52-4889-b29d-9ff2dcf909b2"; start="f13ad06d-8530-4af1-8cf3-d6d75c1635d4@tempuri.org"; start-Info="text/xml; charset=UTF-8"
由于我无法真正更改服务器服务,我想知道是否有办法强制 Chrome 使用小写标题值而不是转换它们。
类似帖子:
【问题讨论】:
标签: javascript ajax google-chrome sharepoint http-post