React-admin: missing 'x-total-count' but it exists in the response header

Created on 24 Mar 2019  路  1Comment  路  Source: marmelab/react-admin

What you were expecting:
no more complains about 'x-total-count'

What happened instead:
missing 'x-total-count'

Steps to reproduce:
on client side

 <Admin dataProvider={jsonServerProvider("http://localhost:8000")}>
             //...
            </Admin>

on server side

app.get("/company", async (req, res) => {
   // ...
    const total = await Company.count();
    res.set("x-total-count", total);
    res.send(data);
});

Other information:
tracked down to convertDataRequestToHTTP
the only header in the response is content-type application/json; charset=utf-8
all other headers got removed?

Environment

  • React-admin version: 2.8.2
  • Last version that did not exhibit the issue (if applicable):
  • React version: 16.8.4
  • Browser: Chrome
  • Stack trace (in case of a JS error):

Most helpful comment

If it helps anyone, as the warning suggests, I had to add:

res.header('Access-Control-Expose-Headers', 'X-Total-Count')

in my express app to the response for cors 'OPTIONS' request.

>All comments

If it helps anyone, as the warning suggests, I had to add:

res.header('Access-Control-Expose-Headers', 'X-Total-Count')

in my express app to the response for cors 'OPTIONS' request.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marknelissen picture marknelissen  路  3Comments

kdabir picture kdabir  路  3Comments

mbj36 picture mbj36  路  3Comments

alukito picture alukito  路  3Comments

9747749366 picture 9747749366  路  3Comments