jonsamwell / angular-http-batcher

Enables HTTP batch request with AngularJS
MIT License
96 stars 28 forks source link

Support AngularJS's JSON Vulnerability Protection prefix #22

Closed riaann closed 9 years ago

riaann commented 9 years ago

Avoids an error on parsing responses that occurs when the AngularJS JSON Vulnerability Protection prefix, ")]}'," is added to responses. See https://docs.angularjs.org/api/ng/service/$http#json-vulnerability-protection for more details.

Includes a unit test to test for this scenario.

jonsamwell commented 9 years ago

Thanks for this!!!

I've just completely re-factored the library to work with the idea of adapters that are responsible for transforming multiple http requests into a single batch request and then parse the batch response back in multi responses (see the default adapter https://github.com/jonsamwell/angular-http-batcher/blob/master/src/services/adapters/httpAdapter.js). The idea being the library can now support multiple different batching technologies i.e. http 1.1, node js implementations, Facebook etc.

So unfortunately your pull request will now have conflicts, but its a great addition and I really want it in! I need to do up a bit of a util service to do things like url parsing etc where we could put this vulnerability protection function so all the adapters could use it.

I'll get the util in tomorrow if you want to update the pull request or I can put it in if you would rather?

Thanks again!!!

Jon

jonsamwell commented 9 years ago

I've added this here now and credited you in the change log.

https://github.com/jonsamwell/angular-http-batcher/blob/master/src/services/httpBatcher.js#L55 https://github.com/jonsamwell/angular-http-batcher/blob/master/dist/ChangeLog.txt#L3

Thanks very much for this!!!

riaann commented 9 years ago

Sorry for only seeing this now - am on leave, so wasn't keeping up with email. Otherwise I would gladly have updated the pull request.

Thank you for giving me credit anyway! :)

On Tue, 11 Aug 2015, 02:33 Jon Samwell notifications@github.com wrote:

Closed #22 https://github.com/jonsamwell/angular-http-batcher/pull/22.

— Reply to this email directly or view it on GitHub https://github.com/jonsamwell/angular-http-batcher/pull/22#event-378609965 .

jonsamwell commented 9 years ago

No thank you for submitting it! I've given the library a really heavy refactor and it is much better because of it. Anyway thanks again and really glad you are using the module. Let me know if you have any other features ideas for the library and feel free to send other pull requests in!