Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

Add WriteJSONWithStatus-function to write JSON with status #3

Closed
wants to merge 1 commit into from
Closed

Add WriteJSONWithStatus-function to write JSON with status #3

wants to merge 1 commit into from

Conversation

robintemme
Copy link
Collaborator

Self-explanatory function to add support for a different status code than 200, but with an own interface.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.94%) to 87.42% when pulling 5eb7349 on zwerch:master into af9af6f on bahlo:master.

@bahlo
Copy link
Owner

bahlo commented Apr 23, 2015

Thanks for the PR! Maybe a name like WriteJSONStatus would be more ideomatic.

And it would be great if you'd write a test for it. So we don't loose coverage 👍

@coveralls
Copy link

Coverage Status

Coverage increased (+0.39%) to 88.74% when pulling 7ba6634 on zwerch:master into af9af6f on bahlo:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.39%) to 88.74% when pulling 889216e on zwerch:master into af9af6f on bahlo:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.39%) to 88.74% when pulling 34c400b on zwerch:master into af9af6f on bahlo:master.

func WriteJSONWithStatus(w http.ResponseWriter, code int, v interface{}) {
w.WriteHeader(code)

WriteJSON(w, v)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please return the error from WriteJSON again, so it's possible to check for them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, of course. Will do.

@bahlo bahlo added the bug label Feb 18, 2016
@bahlo
Copy link
Owner

bahlo commented Mar 21, 2016

Fixed in 1.0.7.

@bahlo bahlo closed this Mar 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants