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

Error: Expected 'OData-Version' header with value '4.0' but received value 'null' in response #2175

Closed
lukasz-sawicki opened this issue Aug 26, 2018 · 1 comment

Comments

@lukasz-sawicki
Copy link

OpenUI5 version: openui5-runtime-1.56.5

Browser/version (+device/version):Chrome/Laptop

Steps to reproduce the problem:

  1. Trying to recreate ODATA V4 Tutorial using mock data on a local server created in werkzeug/python 3.6.5. This runs on http://localhost:4000
  2. Metadata retrieved OK.
  3. Call to http://localhost:4000/TripPinRESTierService/(S(LSA123))/People?$select=Age,FirstName,LastName,UserName&$skip=0&$top=10 ends with

Failed to get contexts for http://localhost:4000/TripPinRESTierService/(S(LSA123))/People with start index 0 and length 10 - Error: Expected 'OData-Version' header with value '4.0' but received value 'null' in response for http://localhost:4000/TripPinRESTierService/(S(LSA123))/People?$select=Age,FirstName,LastName,UserName&$skip=0&$top=10
at R.doCheckVersionHeader (https://sapui5.hana.ondemand.com/sdk/resources/sap/ui/core/library-preload.js:3564:314)

the response header:
HTTP/1.0 200
Content-Type: application/json; odata.metadata=minimal
Access-Control-Allow-Origin: *
OData-Version: 4.0
Content-Length: 1189
Server: Werkzeug/0.14.1 Python/3.6.5
Date: Sun, 26 Aug 2018 01:02:21 GMT

response body:
{
"@odata.context": "http://localhost:4000/TripPinRESTierService/(S(LSA123))/$metadata#People(Age,FirstName,LastName,UserName)",
"value": [
{
"Age": 23,
"FirstName": "Angel",
"LastName": "Huffman",
"UserName": "angelhuffman"
},
{
"Age": 44,
"FirstName": "Clyde",
"LastName": "Guess",
"UserName": "clydeguess"
},
{
"Age": 19,
"FirstName": "Elaine",
"LastName": "Stewart",
"UserName": "elainestewart"
},
{
"Age": 37,
"FirstName": "Genevieve",
"LastName": "Reeves",
"UserName": "genevievereeves"
},
{
"Age": 25,
"FirstName": "Georgina",
"LastName": "Barlow",
"UserName": "georginabarlow"
},
{
"Age": 19,
"FirstName": "Javier",
"LastName": "Alfred",
"UserName": "javieralfred"
},
{
"Age": 26,
"FirstName": "Joni",
"LastName": "Rosales",
"UserName": "jonirosales"
},
{
"Age": 41,
"FirstName": "Keith",
"LastName": "Pinckney",
"UserName": "keithpinckney"
},
{
"Age": 30,
"FirstName": "Krista",
"LastName": "Kemp",
"UserName": "kristakemp"
},
{
"Age": 29,
"FirstName": "Laurel",
"LastName": "Osborn",
"UserName": "laurelosborn"
} ]
}

@lukasz-sawicki
Copy link
Author

ok. easier after getting some sleep.
origin url = localhost:8001, odata url localhost:4000. this will not work unless you turn off cors check at browser level or proxy localhost:8001/odata_service to localhost:4000

best regards

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

1 participant