154 lines
4.4 KiB
Java
154 lines
4.4 KiB
Java
/* */ package kong.unirest.cosmetics;
|
|
/* */
|
|
/* */ import java.io.File;
|
|
/* */ import java.io.InputStream;
|
|
/* */ import java.nio.charset.Charset;
|
|
/* */ import java.nio.charset.StandardCharsets;
|
|
/* */ import java.util.Collection;
|
|
/* */ import java.util.Map;
|
|
/* */ import java.util.Optional;
|
|
/* */ import kong.unirest.cosmetics.json.JSONElement;
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */ class HttpRequestBody
|
|
/* */ extends BaseRequest<HttpRequestWithBody>
|
|
/* */ implements HttpRequestWithBody
|
|
/* */ {
|
|
/* 40 */ private Charset charSet = StandardCharsets.UTF_8;
|
|
/* */
|
|
/* */ public HttpRequestBody(Config config, HttpMethod method, String url) {
|
|
/* 43 */ super(config, method, url);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public MultipartBody field(String name, Collection<?> value) {
|
|
/* 48 */ return (new HttpRequestMultiPart(this)).field(name, value);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public MultipartBody field(String name, File file) {
|
|
/* 53 */ return field(name, file, (String)null);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public MultipartBody field(String name, File file, String contentType) {
|
|
/* 58 */ return (new HttpRequestMultiPart(this)).field(name, file, contentType);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public MultipartBody field(String name, Object value) {
|
|
/* 63 */ return field(name, value, (String)null);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public MultipartBody field(String name, Object value, String contentType) {
|
|
/* 68 */ return (new HttpRequestMultiPart(this)).field(name, value, contentType);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public MultipartBody fields(Map<String, Object> parameters) {
|
|
/* 73 */ return (new HttpRequestMultiPart(this)).fields(parameters);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public MultipartBody field(String name, InputStream stream, ContentType contentType, String fileName) {
|
|
/* 78 */ return (new HttpRequestMultiPart(this)).field(name, stream, contentType, fileName);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public MultipartBody multiPartContent() {
|
|
/* 83 */ return (new HttpRequestMultiPart(this)).forceMultiPart(true);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public MultipartBody field(String name, InputStream stream, String fileName) {
|
|
/* 88 */ return field(name, stream, ContentType.APPLICATION_OCTET_STREAM, fileName);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public HttpRequestBody charset(Charset charset) {
|
|
/* 93 */ this.charSet = charset;
|
|
/* 94 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public RequestBodyEntity body(JsonNode body) {
|
|
/* 99 */ return body(body.toString());
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public RequestBodyEntity body(String body) {
|
|
/* 104 */ return (new HttpRequestUniBody(this)).body(body);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public RequestBodyEntity body(InputStream body) {
|
|
/* 109 */ return (new HttpRequestUniBody(this)).body(body);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public RequestBodyEntity body(Object body) {
|
|
/* 114 */ return (new HttpRequestUniBody(this)).body(body);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public RequestBodyEntity body(byte[] body) {
|
|
/* 119 */ return (new HttpRequestUniBody(this)).body(body);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */ public RequestBodyEntity body(JSONElement body) {
|
|
/* 130 */ return body(body.toString());
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public Charset getCharset() {
|
|
/* 135 */ return this.charSet;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public HttpRequestWithBody contentType(String type) {
|
|
/* 140 */ this.headers.add("Content-Type", type);
|
|
/* 141 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public Optional<Body> getBody() {
|
|
/* 146 */ return Optional.empty();
|
|
/* */ }
|
|
/* */ }
|
|
|
|
|
|
/* Location: C:\Users\Xiao\Downloads\MinehutCosmetics.jar!\kon\\unirest\cosmetics\HttpRequestBody.class
|
|
* Java compiler version: 11 (55.0)
|
|
* JD-Core Version: 1.1.3
|
|
*/ |