Comments (5)
Just to update, as you will notice I was allowing the bad requests to save as objects on the api. I went ahead an threw a 400 if the data was empty, and sure enough as I expected, the http-client ignored the 400 and came back with the 201 (of the good request with the proper data).
from http-client.
Hi there,
I've created a Unit Test to check whether it's an API issue. Seems not to be so. Here is the code if you wan't to check it yourself:
it('should make only one request (Issue #25)', () => {
var content = { name: "A demo name" };
var client = new HttpClient()
.configure(x => {
x.withBaseUrl(baseUrl);
x.withHeader('Content-Type', 'application/json');
});
client.post('some/cool/path', content);
expect(jasmine.Ajax.requests.count()).toBe(1);
});
So I guess it's related to something specific to your application. Dunno maybe you're calling the method by incident a second time or so. Just add a breakpoint to your addOrganization()
method to see if it's executed twice.
from http-client.
The addOrganization() function is only being called upon a form submittal. So unless the form is being submitted twice, I am not sure how my application would be making double requests. Just the behavior of the two requests really seems like a bug somewhere. One was completely silent as far as dev tools was concerned, the other was not. I will take a look again at my code, but it really is dead simple whats going on.
from http-client.
And now it seems to no longer be doing it at all. shrug. I did do some refactoring of all that code so i suppose I must of been doing something whacky previously. Thanks for taking the time to write up a test case for my own error :)
from http-client.
No problem at all. Glad it got solved
from http-client.
Related Issues (20)
- How can i abort http-client request? HOT 3
- responseType field is missing in HttpResponseMessage declaration HOT 3
- Headers are not treated as case insensitive HOT 4
- Custom headers not accessible in CORS response HOT 5
- response Type is set to wrong one(json) when the actual response is a string with Content-Type "text/plain" HOT 3
- http-client should create xhr hook to support cross cutting features HOT 3
- Interceptor return types are incorrect. HOT 11
- Add setting for traditional buildQueryString HOT 4
- Passing ArrayBuffer as content produces unintuitive behavior HOT 2
- Abort works incorrectly for delayed requests HOT 2
- Download progress callback missing
- Feature Request: .withForm() and .withFormData() HOT 2
- TC39 proposal cancellation HOT 1
- Interceptors cannot short-circuit request/response HOT 1
- [Breaking] version 1.2 query changes breaks client.configure(o => o.withParams(params)) HOT 4
- Make request available in interceptor responseError HOT 1
- Cancel method is not propagated to then promises HOT 1
- statusCode 500, throw statusCode 0 HOT 2
- multipart/form-data queries have a null Content-Length in some cases
- Content-Type header is overridden to text/plain in no-cors mode HOT 5
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 http-client.