Fix handling of parameters when documenting non-GET requests
Fixes gh-683
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2020 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.
|
||||
@@ -91,8 +91,10 @@ public class CurlRequestSnippet extends TemplatedSnippet {
|
||||
}
|
||||
|
||||
private boolean includeParametersInUri(OperationRequest request) {
|
||||
return request.getMethod() == HttpMethod.GET || (request.getContent().length > 0
|
||||
&& !MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(request.getHeaders().getContentType()));
|
||||
HttpMethod method = request.getMethod();
|
||||
return (method != HttpMethod.PUT && method != HttpMethod.POST && method != HttpMethod.PATCH)
|
||||
|| (request.getContent().length > 0 && !MediaType.APPLICATION_FORM_URLENCODED
|
||||
.isCompatibleWith(request.getHeaders().getContentType()));
|
||||
}
|
||||
|
||||
private String getOptions(Operation operation) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2020 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.
|
||||
@@ -129,8 +129,10 @@ public class HttpieRequestSnippet extends TemplatedSnippet {
|
||||
}
|
||||
|
||||
private boolean includeParametersInUri(OperationRequest request) {
|
||||
return request.getMethod() == HttpMethod.GET || (request.getContent().length > 0
|
||||
&& !MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(request.getHeaders().getContentType()));
|
||||
HttpMethod method = request.getMethod();
|
||||
return (method != HttpMethod.PUT && method != HttpMethod.POST && method != HttpMethod.PATCH)
|
||||
|| (request.getContent().length > 0 && !MediaType.APPLICATION_FORM_URLENCODED
|
||||
.isCompatibleWith(request.getHeaders().getContentType()));
|
||||
}
|
||||
|
||||
private boolean includeParametersAsFormOptions(OperationRequest request) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2020 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.
|
||||
@@ -92,8 +92,10 @@ public class HttpRequestSnippet extends TemplatedSnippet {
|
||||
}
|
||||
|
||||
private boolean includeParametersInUri(OperationRequest request) {
|
||||
return request.getMethod() == HttpMethod.GET || (request.getContent().length > 0
|
||||
&& !MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(request.getHeaders().getContentType()));
|
||||
HttpMethod method = request.getMethod();
|
||||
return (method != HttpMethod.PUT && method != HttpMethod.POST && method != HttpMethod.PATCH)
|
||||
|| (request.getContent().length > 0 && !MediaType.APPLICATION_FORM_URLENCODED
|
||||
.isCompatibleWith(request.getHeaders().getContentType()));
|
||||
}
|
||||
|
||||
private List<Map<String, String>> getHeaders(OperationRequest request) {
|
||||
|
||||
Reference in New Issue
Block a user