Skip to content

Commit

Permalink
fix(web_api): properly marshal protos with jsonpb (#3424)
Browse files Browse the repository at this point in the history
  • Loading branch information
schroederc committed Feb 1, 2019
1 parent 17fbd02 commit 358b406
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kythe/go/services/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ func WriteJSONResponse(w http.ResponseWriter, r *http.Request, v interface{}) er
w.Header().Set("Content-Type", "application/json; charset=utf-8")
cw := httpencoding.CompressData(w, r)
defer cw.Close()
if msg, ok := v.(proto.Message); ok {
return JSONMarshaler.Marshal(cw, msg)
}
return json.NewEncoder(cw).Encode(v)
}

Expand Down

0 comments on commit 358b406

Please sign in to comment.