Skip to content

Commit da63de4

Browse files
committed
Use consistent protobuf media type
1 parent ecaafc1 commit da63de4

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

plugin/src/main/java/com/flit/protoc/gen/server/jaxrs/RpcGenerator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,18 @@ private void addConstructor() {
4848

4949
private void addHandleMethod(MethodDescriptorProto mdp) {
5050
ClassName inputType = mapper.get(mdp.getInputType());
51-
ClassName outputType = mapper.get(mdp.getOutputType());
5251
rpcResource.addMethod(MethodSpec.methodBuilder("handle" + mdp.getName())
5352
.addModifiers(Modifier.PUBLIC)
5453
.addAnnotation(POST)
5554
.addAnnotation(AnnotationSpec.builder(PATH)
5655
.addMember("value", "$S", "/" + mdp.getName())
5756
.build())
5857
.addAnnotation(AnnotationSpec.builder(PRODUCES)
59-
.addMember("value", "$S", "application/x-protobuf")
58+
.addMember("value", "$S", "application/protobuf")
6059
.addMember("value", "$S", "application/json")
6160
.build())
6261
.addAnnotation(AnnotationSpec.builder(CONSUMES)
63-
.addMember("value", "$S", "application/x-protobuf")
62+
.addMember("value", "$S", "application/protobuf")
6463
.addMember("value", "$S", "application/json")
6564
.build())
6665
.addParameter(inputType, "request")

plugin/src/test/java/com/flit/protoc/gen/server/jaxrs/HelloworldGeneratorTest.test_Generate.approved.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ public class RpcHelloWorldResource {
2525
@POST
2626
@Path("/Hello")
2727
@Produces({
28-
"application/x-protobuf",
28+
"application/protobuf",
2929
"application/json"
3030
})
3131
@Consumes({
32-
"application/x-protobuf",
32+
"application/protobuf",
3333
"application/json"
3434
})
3535
public Response handleHello(Helloworld.HelloReq request) {
@@ -39,11 +39,11 @@ public class RpcHelloWorldResource {
3939
@POST
4040
@Path("/HelloAgain")
4141
@Produces({
42-
"application/x-protobuf",
42+
"application/protobuf",
4343
"application/json"
4444
})
4545
@Consumes({
46-
"application/x-protobuf",
46+
"application/protobuf",
4747
"application/json"
4848
})
4949
public Response handleHelloAgain(Helloworld.HelloReq request) {

plugin/src/test/java/com/flit/protoc/gen/server/jaxrs/StatusGeneratorTest.test_Generate.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ public class RpcStatusResource {
2323
@POST
2424
@Path("/GetStatus")
2525
@Produces({
26-
"application/x-protobuf",
26+
"application/protobuf",
2727
"application/json"
2828
})
2929
@Consumes({
30-
"application/x-protobuf",
30+
"application/protobuf",
3131
"application/json"
3232
})
3333
public Response handleGetStatus(Core.Empty request) {

0 commit comments

Comments
 (0)