Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom JSON response content #17

Closed
Discountrobot opened this issue Aug 3, 2016 · 2 comments
Closed

Custom JSON response content #17

Discountrobot opened this issue Aug 3, 2016 · 2 comments

Comments

@Discountrobot
Copy link

Discountrobot commented Aug 3, 2016

Hello.

I'm required to return error responses in the below format

{
  "code": "BAD_ARGUMENTS"
  ...
}

But currently send-json.js restricts us to the below format

{
  "error": {
    "code": "BAD_ARGUMENTS"
    ...
  }
}

Is there a solution to this that does not involve me maintaining multiple forks?

Thanks

@bajtos bajtos changed the title send-json response content Custom JSON response content Oct 26, 2016
@bajtos
Copy link
Member

bajtos commented Oct 26, 2016

Hi @Discountrobot, we don't allow custom JSON error responses right now.

When we were designing this module, we had an idea to allow custom JSON serialization, see #8. I think it should be reasonably easy to extend that idea to support your use case too.

Can you contribute this feature yourself?

@bajtos
Copy link
Member

bajtos commented Mar 13, 2017

Closing as a duplicate of #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants