brapi-java-client/src/main/java/org/brapi/client/v2/BrAPIClient.java
public Request buildRequest(String path, String method, Map<String, String> queryParams, Map<String, String> collectionQueryParams,
			Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames) throws ApiException {
		updateParamsForAuth(authNames, queryParams, headerParams);

		final String url = buildUrl(path, queryParams, collectionQueryParams);
		final Request.Builder reqBuilder = new Request.Builder().url(url);
		processHeaderParams(headerParams, reqBuilder);

		String contentType = (String) headerParams.get("Content-Type");
		// ensuring a default content type
		if (contentType == null) {
			contentType = "application/json";
		}

		RequestBody reqBody;
		if (!HttpMethod.permitsRequestBody(method)) {
			reqBody = null;
		} else if ("application/x-www-form-urlencoded".equals(contentType)) {
//            reqBody = buildRequestBodyFormEncoding(formParams);
			reqBody = null;
		} else if ("multipart/form-data".equals(contentType)) {
//            reqBody = buildRequestBodyMultipart(formParams);
			reqBody = null;
		} else if (body == null) {
			if ("DELETE".equals(method)) {
				// allow calling DELETE without sending a request body
				reqBody = null;
			} else {
				// use an empty request body (for POST, PUT and PATCH)
				reqBody = RequestBody.create(MediaType.parse(contentType), "");
			}
		} else {
			reqBody = serialize(body, contentType);
		}

		Request request = reqBuilder.method(method, reqBody).build();

		return request;
	}
/**
	 * Build an HTTP request with the given options.
	 *
	 * @param path                    The sub-path of the HTTP URL
	 * @param method                  The request method, one of "GET", "HEAD",
	 *                                "OPTIONS", "POST", "PUT", "PATCH" and "DELETE"
	 * @param queryParams             The query parameters
	 * @param collectionQueryParams   The collection query parameters
	 * @param body                    The request body object
	 * @param headerParams            The header parameters
	 * @param formParams              The form parameters
	 * @param authNames               The authentications to apply
	 * @param progressRequestListener Progress request listener
	 * @return The HTTP request
	 * @throws ApiException If fail to serialize the request body object
	 */
Build an HTTP request with the given options.
Build an HTTP request with the given options .
public Request buildRequest(String path, String method, Map<String, String> queryParams, Map<String, String> collectionQueryParams,
			Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames) throws ApiException {
		updateParamsForAuth(authNames, queryParams, headerParams);
		final String url = buildUrl(path, queryParams, collectionQueryParams);
		final Request.Builder reqBuilder = new Request.Builder().url(url);
		processHeaderParams(headerParams, reqBuilder);
		String contentType = (String) headerParams.get("Content-Type");
		if (contentType == null) {
			contentType = "application/json";
		}
		RequestBody reqBody;
		if (!HttpMethod.permitsRequestBody(method)) {
			reqBody = null;
		} else if ("application/x-www-form-urlencoded".equals(contentType)) {
			reqBody = null;
		} else if ("multipart/form-data".equals(contentType)) {
			reqBody = null;
		} else if (body == null) {
			if ("DELETE".equals(method)) {
				reqBody = null;
			} else {
				reqBody = RequestBody.create(MediaType.parse(contentType), "");
			}
		} else {
			reqBody = serialize(body, contentType);
		}
		Request request = reqBuilder.method(method, reqBody).build();
		return request;
	}
public Request buildRequest ( String path , String method , Map < String , String > queryParams , Map < String , String > collectionQueryParams , Object body , Map < String , String > headerParams , Map < String , Object > formParams , String [ ] authNames ) throws ApiException { updateParamsForAuth ( authNames , queryParams , headerParams ) ; final String url = buildUrl ( path , queryParams , collectionQueryParams ) ; final Request . Builder reqBuilder = new Request . Builder ( ) . url ( url ) ; processHeaderParams ( headerParams , reqBuilder ) ; String contentType = ( String ) headerParams . get ( "Content-Type" ) ; if ( contentType == null ) { contentType = "application/json" ; } RequestBody reqBody ; if ( ! HttpMethod . permitsRequestBody ( method ) ) { reqBody = null ; } else if ( "application/x-www-form-urlencoded" . equals ( contentType ) ) { reqBody = null ; } else if ( "multipart/form-data" . equals ( contentType ) ) { reqBody = null ; } else if ( body == null ) { if ( "DELETE" . equals ( method ) ) { reqBody = null ; } else { reqBody = RequestBody . create ( MediaType . parse ( contentType ) , "" ) ; } } else { reqBody = serialize ( body , contentType ) ; } Request request = reqBuilder . method ( method , reqBody ) . build ( ) ; return request ; }
Build an HTTP request with the given options.
Build an HTTP request with the given options .
// ensuring a default content type //            reqBody = buildRequestBodyFormEncoding(formParams); //            reqBody = buildRequestBodyMultipart(formParams); // allow calling DELETE without sending a request body // use an empty request body (for POST, PUT and PATCH)