janhommes / o.js

o.js - client side oData lib.
https://janhommes.github.io/o.js/example/
MIT License
241 stars 58 forks source link

Adding a timeout #38

Closed HZSamir closed 7 years ago

HZSamir commented 7 years ago

Hello, I would like to add a timeout of 2 seconds to all my requests (using NodeJS). I tried modifying the o.js file at line 1450 like this:

var Xhr2 = require('xhr2');
xhr = new Xhr2();
xhr.timeout = 2000;

to no avail. Is there some way I can remedy this issue? Thank you.

janhommes commented 7 years ago

Hi,

xhr2 is an external lib we implemented for node.js support. Normaly your approach should work. If not, it might be an issue with the xhr2 lib implementation. Please open an issue there.

Not quite sure but maybe you can try:

xhr = new Xhr2({ timeout: 2000 });

Regards Jan

HZSamir commented 7 years ago

Thank you for the fast answer. I believe you are right, it is working now. Good day.