天天看點

關于Chrome支援http header最大長度限制的讨論Test url

Created by Wang, Jerry, last modified on Nov 09, 2016

我們在前端通路ABAP的server的時候,通過OData協定通路一個API的時候,URL中能不能帶單引号呢? 我們遇到一個bug,

(1) 在IE裡url帶了單引号:

https://jerry.neo.ondemand.com/dps/odata.svc/Context?KaTeX

parse error: Expected 'EOF', got '&' at position 14: orderby=title&̲filter=appUrl%20eq%20%‘CustomerEngagementCenter’%20and%20product%20eq%20’SAP_HYBRIS_CLOUD’%20and%20version%20eq%20’1611’%20and%20(system%20eq%20null%20or%20system%20eq%20’’)%20and%20locale%20eq%20’en-US’

(2) 在Chrome沒有單引号:

parse error: Expected 'EOF', got '&' at position 14: orderby=title&̲filter=appUrl%20eq%20%27CustomerEngagementCenter%27%20and%20product%20eq%20%27SAP_HYBRIS_CLOUD%27%20and%20version%20eq%20%271611%27%20and%20(system%20eq%20null%20or%20system%20eq%20%27%27)%20and%20locale%20eq%20%27en-US%27

結果就是帶單引号的URL不能被ABAP Server處理,直接是HTTP 400錯誤。是以我想問下,是不是按照OData的協定URL裡是不能帶單引号的?

我試了下,在Chrome裡,位址欄敲’i042416’, 單引号會自動被encode成%27:

關于Chrome支援http header最大長度限制的讨論Test url
關于Chrome支援http header最大長度限制的讨論Test url
關于Chrome支援http header最大長度限制的讨論Test url
關于Chrome支援http header最大長度限制的讨論Test url

Test url

http://jerry:50054/sap/bc/abap/zjerry

It is impossible to manually set header Referer in Postman.

繼續閱讀