Comments (2)
Any updates on this? We're getting these errors too.
from browser-request.
I ended up writing a small shim for the request module that fit our very targeted needs (implemented the very minimum that we use from the request module). I would strongly prefer the browser-request module, but to get around this bug we used the shim (note that it assumes jquery is on the page as $).
module.exports = {
get: function(options, callback){
$.ajax({
url: options.url,
timeout: options.timeout,
dataType: options.json === true ? 'json' : null,
error: function(jqXHR, textStatus, errorThrown) {
var errorMessage = "Error occurred while requesting " + options.url + ".";
if (textStatus) {
errorMessage += " Error status: " + textStatus;
if (errorThrown && errorThrown !== textStatus) {
errorMessage += " | Error Thrown: " + errorThrown;
}
}
var error = new Error(errorMessage);
if (textStatus === 'timeout') {
error.code === 'ETIMEDOUT'
}
error.status = jqXHR.status;
callback(error);
},
success: function(data, textStatus, jqXHR){
var responseObj = {
statusCode: jqXHR.status,
body: data
};
callback(null, responseObj, data);
}
});
}
};
In package.json I added this:
{
...
"browser": {
"request": "./lib/browserRequestShim.js"
}
...
}
from browser-request.
Related Issues (20)
- Basic Auth Base64 endocding
- json:true should parse the response to json object HOT 1
- json:true writes to body even if there's nothing to write
- Not support bearer authentication HOT 1
- Content-Type is application/json,application/json
- request module work in browser HOT 1
- Request works in Chrome, fails in Firefox with "CORS request rejected" error HOT 2
- default baseUrl is not working
- formData not supported HOT 4
- Unexpected end of JSON input - Offline mode HOT 1
- Does your library support cookies?
- Refused to set unsafe header "User-Agent"
- Typescript support HOT 1
- Uncaught error, no options given
- Simple way to make a request sync? HOT 1
- window.request is undefined
- Support proxy option
- Is anyone still maintaining this library? HOT 4
- Sending an image file using the form? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from browser-request.