File tree 4 files changed +59
-1
lines changed
springdoc-openapi-common/src/main/java/org/springdoc/core
springdoc-openapi-webmvc-core/src/test
java/test/org/springdoc/api/app97
4 files changed +59
-1
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,8 @@ else if (ArrayUtils.isNotEmpty(classConsumes))
147
147
if (ArrayUtils .isNotEmpty (headers ))
148
148
for (String header : headers ) {
149
149
String [] keyValueHeader = header .split ("=" );
150
- this .headers .put (keyValueHeader [0 ], keyValueHeader [1 ]);
150
+ String headerValue = keyValueHeader .length > 1 ? keyValueHeader [1 ] : "" ;
151
+ this .headers .put (keyValueHeader [0 ], headerValue );
151
152
}
152
153
}
153
154
Original file line number Diff line number Diff line change @@ -36,4 +36,8 @@ public StudentV2 headerV2() {
36
36
return new StudentV2 ("Charlie" );
37
37
}
38
38
39
+ @ GetMapping (value = "/student/header3" , headers = "X-API-VERSION" )
40
+ public StudentV3 headerV3 () {
41
+ return new StudentV3 ("Tom Charlie" );
42
+ }
39
43
}
Original file line number Diff line number Diff line change
1
+ package test .org .springdoc .api .app97 ;
2
+
3
+ import com .fasterxml .jackson .annotation .JsonProperty ;
4
+
5
+ public class StudentV3 {
6
+
7
+ @ JsonProperty ("name" )
8
+ private String name ;
9
+
10
+ public StudentV3 (String name ) {
11
+ this .name = name ;
12
+ }
13
+ }
Original file line number Diff line number Diff line change 11
11
}
12
12
],
13
13
"paths" : {
14
+ "/api/student/header3" : {
15
+ "get" : {
16
+ "tags" : [
17
+ " hello-controller"
18
+ ],
19
+ "operationId" : " headerV3" ,
20
+ "parameters" : [
21
+ {
22
+ "name" : " X-API-VERSION" ,
23
+ "in" : " header" ,
24
+ "schema" : {
25
+ "type" : " string" ,
26
+ "enum" : [
27
+ " "
28
+ ]
29
+ }
30
+ }
31
+ ],
32
+ "responses" : {
33
+ "200" : {
34
+ "description" : " default response" ,
35
+ "content" : {
36
+ "*/*" : {
37
+ "schema" : {
38
+ "$ref" : " #/components/schemas/StudentV3"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ },
14
46
"/api/student/header2" : {
15
47
"get" : {
16
48
"tags" : [
78
110
},
79
111
"components" : {
80
112
"schemas" : {
113
+ "StudentV3" : {
114
+ "type" : " object" ,
115
+ "properties" : {
116
+ "name" : {
117
+ "type" : " string"
118
+ }
119
+ }
120
+ },
81
121
"StudentV2" : {
82
122
"type" : " object" ,
83
123
"properties" : {
You can’t perform that action at this time.
0 commit comments