Skip to content

Commit eadc359

Browse files
committed
Make JSONPb default
1 parent ef0c15e commit eadc359

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

runtime/marshaler_registry.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import (
88
const mimeWildcard = "*"
99

1010
var (
11-
inboundDefaultMarshaler = new(JSONBuiltin)
12-
outboundDefaultMarshaler = new(JSONBuiltin)
11+
defaultMarshaler = &JSONPb{OrigName: true}
1312

1413
contentTypeHeader = http.CanonicalHeaderKey("Content-Type")
1514
)
@@ -39,10 +38,10 @@ func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, out
3938
}
4039
}
4140
if inbound == nil {
42-
inbound = inboundDefaultMarshaler
41+
inbound = defaultMarshaler
4342
}
4443
if outbound == nil {
45-
outbound = outboundDefaultMarshaler
44+
outbound = defaultMarshaler
4645
}
4746
return inbound, outbound
4847

runtime/marshaler_registry_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ func TestMarshalerForRequest(t *testing.T) {
1919
mux := runtime.NewServeMux()
2020

2121
in, out := runtime.MarshalerForRequest(mux, r)
22-
if _, ok := in.(*runtime.JSONBuiltin); !ok {
23-
t.Errorf("in = %#v; want a runtime.JSONBuiltin", in)
22+
if _, ok := in.(*runtime.JSONPb); !ok {
23+
t.Errorf("in = %#v; want a runtime.JSONPb", in)
2424
}
25-
if _, ok := out.(*runtime.JSONBuiltin); !ok {
26-
t.Errorf("out = %#v; want a runtime.JSONBuiltin", in)
25+
if _, ok := out.(*runtime.JSONPb); !ok {
26+
t.Errorf("out = %#v; want a runtime.JSONPb", in)
2727
}
2828

2929
var marshalers [6]dummyMarshaler

0 commit comments

Comments
 (0)