Closed kerubkim closed 2 years ago
Any input on how you fixed this? I am getting the same error just with the example from the Readme
For anyone getting this error with Node > v18 and native fetch based on undici, it appears you need to set the referrer yourself:
const url = "https://services.odata.org/V4/Northwind/Northwind.svc/"; const config = { referrer: new URL("client", "http://localhost").toString(), }; const northwind = o(url, config);
const data = await northwind.get("Products").query({ $top: 1 });
I was using this package before I updated to a new node version. After the update I am currently getting
TypeError: Referrer "client" is not a valid URL.
Odata example:
const result = o("some-external-api-url", { headers: { Authorization: 'Bearer ${accessToken}', }, fragment: "", // fragment defaults to "value" which just returns the data });
Node: v18.2.0 odata: ^1.3.1