Add HTTP method option unconditionally in curl command

Closes gh-488
This commit is contained in:
Johnny Lim
2018-03-26 21:58:53 +09:00
committed by Andy Wilkinson
parent 95c4234c99
commit da64c55fce
5 changed files with 34 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -128,7 +128,7 @@ public class CurlRequestSnippet extends TemplatedSnippet {
CliOperationRequest request = new CliOperationRequest(operation.getRequest());
writeUserOptionIfNecessary(request, builder);
writeHttpMethodIfNecessary(request, builder);
writeHttpMethod(request, builder);
List<String> additionalLines = new ArrayList<>();
writeHeaders(request, additionalLines);
@@ -167,11 +167,8 @@ public class CurlRequestSnippet extends TemplatedSnippet {
}
}
private void writeHttpMethodIfNecessary(OperationRequest request,
StringBuilder builder) {
if (!HttpMethod.GET.equals(request.getMethod())) {
builder.append(String.format(" -X %s", request.getMethod()));
}
private void writeHttpMethod(OperationRequest request, StringBuilder builder) {
builder.append(String.format(" -X %s", request.getMethod()));
}
private void writeHeaders(CliOperationRequest request, List<String> lines) {