emartech / suite-js-sdk

Simple Javascript wrapper for the Emarsys API
MIT License
9 stars 35 forks source link

Escher request authenticator can fail as JSON.stringify(JSON.parse(x)) is not idempotent #108

Closed gabor-balla-emarsys closed 8 years ago

gabor-balla-emarsys commented 8 years ago

If the payload is a standard JSON, but different from the one JSON.stringify would generate, escher request authentication fails. https://github.com/emartech/suite-js-sdk/blob/master/authentication/request/request-authenticator.js#L32

I recommend using a request.rawBody property, if available instead of the request.body property. This could be used to attach the raw string body to the request.

bankyadam commented 8 years ago

There is a PR for this: https://github.com/emartech/suite-js-sdk/pull/109

gabor-balla-emarsys commented 8 years ago

As discussed with @drawain, the middleware is to be replaced by: https://github.com/emartech/koa-escher-auth Also the issue is already fixed in that middleware.