com.paypal.http.HttpRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of paypalhttp Show documentation
Show all versions of paypalhttp Show documentation
This is Paypal's generic http library for generated SDKs
package com.paypal.http;
public class HttpRequest {
public HttpRequest(String path, String verb, Class responseClass) {
this.path = path;
this.verb = verb;
this.responseClass = responseClass;
}
private String path;
private String verb;
private Object body;
private Class responseClass;
private Headers headers = new Headers();
public HttpRequest path(String path) {
this.path = path;
return this;
}
public HttpRequest verb(String verb) {
this.verb = verb;
return this;
}
public HttpRequest requestBody(Object body) {
this.body = body;
return this;
}
public String path() {
return this.path;
}
public String verb() {
return this.verb;
}
public Object requestBody() {
return this.body;
}
public Headers headers() {
return this.headers;
}
public Class responseClass() {
return this.responseClass;
}
public HttpRequest header(String header, String value) {
headers.header(header, value);
return this;
}
public HttpRequest copy() {
HttpRequest other = new HttpRequest(path, verb, responseClass);
for (String key: headers) {
other.header(key, headers.header(key));
}
other.body = body;
return other;
}
}