Skip to content

Commit 39ac8f6

Browse files
committed
added patch support
1 parent d764328 commit 39ac8f6

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

src/main/resources/android-java/apiInvoker.mustache

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,18 @@ public class ApiInvoker {
184184
}
185185
response = client.execute(delete);
186186
}
187+
else if ("PATCH".equals(method)) {
188+
HttpPatch patch = new HttpPatch(url);
189+
190+
if (body != null) {
191+
patch.setHeader("Content-Type", contentType);
192+
patch.setEntity(new StringEntity(serialize(body), "UTF-8"));
193+
}
194+
for(String key : headers.keySet()) {
195+
patch.setHeader(key, headers.get(key));
196+
}
197+
response = client.execute(patch);
198+
}
187199

188200
int code = response.getStatusLine().getStatusCode();
189201
String responseString = null;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package {{invokerPackage}};
2+
3+
import org.apache.http.client.methods.*;
4+
5+
public class HttpPatch extends HttpPost {
6+
public static final String METHOD_PATCH = "PATCH";
7+
8+
public HttpPatch(final String url) {
9+
super(url);
10+
}
11+
12+
@Override
13+
public String getMethod() {
14+
return METHOD_PATCH;
15+
}
16+
}

src/main/resources/android-java/pom.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>{{artifactId}}</artifactId>
66
<packaging>jar</packaging>
77
<name>{{artifactId}}</name>
8-
<version>{{apiVersion}}</version>
8+
<version>{{artifactVersion}}</version>
99
<scm>
1010
<connection>scm:git:[email protected]:wordnik/swagger-mustache.git</connection>
1111
<developerConnection>scm:git:[email protected]:wordnik/swagger-codegen.git</developerConnection>

0 commit comments

Comments
 (0)