mirror of
https://github.com/Fishwaldo/rundeck-api-java-client.git
synced 2025-07-07 13:38:23 +00:00
Allow empty content in request
This commit is contained in:
parent
b5f4ec8ccd
commit
0cb3da88ec
2 changed files with 15 additions and 0 deletions
|
@ -310,6 +310,8 @@ class ApiCall {
|
|||
}else if(apiPath.getXmlDocument()!=null) {
|
||||
httpPost.setHeader("Content-Type", "application/xml");
|
||||
httpPost.setEntity(new EntityTemplate(new DocumentContentProducer(apiPath.getXmlDocument())));
|
||||
}else if(apiPath.isEmptyContent()){
|
||||
//empty content
|
||||
}else {
|
||||
throw new IllegalArgumentException("No Form or Multipart entity for POST content-body");
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ class ApiPathBuilder {
|
|||
private InputStream contentStream;
|
||||
private File contentFile;
|
||||
private String contentType;
|
||||
private boolean emptyContent = false;
|
||||
|
||||
/** Marker for using the right separator between parameters ("?" or "&") */
|
||||
private boolean firstParamDone = false;
|
||||
|
@ -308,6 +309,15 @@ class ApiPathBuilder {
|
|||
}
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When POSTing a request, send an empty request.
|
||||
*
|
||||
* @return this, for method chaining
|
||||
*/
|
||||
public ApiPathBuilder emptyContent() {
|
||||
this.emptyContent=true;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When POSTing a request, add the given XMl Document as the content of the request.
|
||||
*
|
||||
|
@ -403,6 +413,9 @@ class ApiPathBuilder {
|
|||
return contentFile;
|
||||
}
|
||||
|
||||
public boolean isEmptyContent() {
|
||||
return emptyContent;
|
||||
}
|
||||
/**
|
||||
* BuildsParameters can add URL or POST parameters to an {@link ApiPathBuilder}
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue