Sahan Amadoruge
01/20/2022, 1:24 PMError: The Content-Range header is missing in the HTTP Response. The simple REST data provider expects responses for lists of resources to contain this header with the total number of results to build the pagination. If you are using CORS, did you declare Content-Range in the Access-Control-Expose-Headers header?
I try to pass the requested header on the response. But still i'm getting this error. What did i miss?
return {
statusCode: 200,
headers: {
'Content-Type': 'application/json',
'Content-Range': 'results 0-24/319'
},
body: JSON.stringify(results),
};
Frank
new sst.Api(this, "Api", {
cors: {
exposeHeaders: ["Content-Range"]
},
});
Sahan Amadoruge
01/21/2022, 6:00 AMSahan Amadoruge
01/21/2022, 6:31 AMcors: {
exposeHeaders: ["Content-Range"],
allowOrigins: ['*'],
},
Here's my response from lambda
return {
statusCode: 200,
headers: {
'Content-Type': 'application/json',
'Content-Range': 'results 0-9/319',
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": true,
},
body: JSON.stringify(results),
};
Sahan Amadoruge
01/24/2022, 7:06 AMFrank
import * as apig from "@aws-cdk/aws-apigatewayv2-alpha";
...
cors: {
exposeHeaders: ["Content-Range"],
allowHeaders: ["*"],
allowMethods: [apig.CorsHttpMethod.ANY],
allowOrigins: ["*"],
},
Sahan Amadoruge
01/24/2022, 10:36 AMSahan Amadoruge
01/25/2022, 11:20 AMFrank
Sahan Amadoruge
02/18/2022, 4:33 AM