### YamlMime:JavaType
uid: "com.azure.core.http.HttpRequest"
fullName: "com.azure.core.http.HttpRequest"
name: "HttpRequest"
nameWithType: "HttpRequest"
summary: "Represents an outgoing HTTP request."
inheritances:
- ""
inheritedClassMethods:
- classRef: "java.lang.Object"
methodsRef:
- "clone"
- "equals"
- "finalize"
- "getClass"
- "hashCode"
- "notify"
- "notifyAll"
- "toString"
- "wait"
- "wait"
- "wait"
syntax: "public class **HttpRequest**"
constructors:
- uid: "com.azure.core.http.HttpRequest.HttpRequest(com.azure.core.http.HttpMethod,java.lang.String)"
fullName: "com.azure.core.http.HttpRequest.HttpRequest(HttpMethod httpMethod, String url)"
name: "HttpRequest(HttpMethod httpMethod, String url)"
nameWithType: "HttpRequest.HttpRequest(HttpMethod httpMethod, String url)"
summary: "Create a new HttpRequest instance."
parameters:
- description: "the HTTP request method"
name: "httpMethod"
type: ""
- description: "the target address to send the request to"
name: "url"
type: "String"
syntax: "public HttpRequest(HttpMethod httpMethod, String url)"
desc: "Create a new HttpRequest instance."
- uid: "com.azure.core.http.HttpRequest.HttpRequest(com.azure.core.http.HttpMethod,java.net.URL)"
fullName: "com.azure.core.http.HttpRequest.HttpRequest(HttpMethod httpMethod, URL url)"
name: "HttpRequest(HttpMethod httpMethod, URL url)"
nameWithType: "HttpRequest.HttpRequest(HttpMethod httpMethod, URL url)"
summary: "Create a new HttpRequest instance."
parameters:
- description: "the HTTP request method"
name: "httpMethod"
type: ""
- description: "the target address to send the request to"
name: "url"
type: "URL"
syntax: "public HttpRequest(HttpMethod httpMethod, URL url)"
desc: "Create a new HttpRequest instance."
- uid: "com.azure.core.http.HttpRequest.HttpRequest(com.azure.core.http.HttpMethod,java.net.URL,com.azure.core.http.HttpHeaders)"
fullName: "com.azure.core.http.HttpRequest.HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers)"
name: "HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers)"
nameWithType: "HttpRequest.HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers)"
summary: "Create a new HttpRequest instance."
parameters:
- description: "the HTTP request method"
name: "httpMethod"
type: ""
- description: "the target address to send the request to"
name: "url"
type: "URL"
- description: "the HTTP headers to use with this request"
name: "headers"
type: ""
syntax: "public HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers)"
desc: "Create a new HttpRequest instance."
- uid: "com.azure.core.http.HttpRequest.HttpRequest(com.azure.core.http.HttpMethod,java.net.URL,com.azure.core.http.HttpHeaders,com.azure.core.util.BinaryData)"
fullName: "com.azure.core.http.HttpRequest.HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, BinaryData body)"
name: "HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, BinaryData body)"
nameWithType: "HttpRequest.HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, BinaryData body)"
summary: "Create a new HttpRequest instance."
parameters:
- description: "the HTTP request method"
name: "httpMethod"
type: ""
- description: "the target address to send the request to"
name: "url"
type: "URL"
- description: "the HTTP headers to use with this request"
name: "headers"
type: ""
- description: "the request content"
name: "body"
type: ""
syntax: "public HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, BinaryData body)"
desc: "Create a new HttpRequest instance."
- uid: "com.azure.core.http.HttpRequest.HttpRequest(com.azure.core.http.HttpMethod,java.net.URL,com.azure.core.http.HttpHeaders,reactor.core.publisher.Flux)"
fullName: "com.azure.core.http.HttpRequest.HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux body)"
name: "HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux body)"
nameWithType: "HttpRequest.HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux body)"
summary: "Create a new HttpRequest instance."
parameters:
- description: "the HTTP request method"
name: "httpMethod"
type: ""
- description: "the target address to send the request to"
name: "url"
type: "URL"
- description: "the HTTP headers to use with this request"
name: "headers"
type: ""
- description: "the request content"
name: "body"
type: "Flux<ByteBuffer>"
syntax: "public HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux body)"
desc: "Create a new HttpRequest instance."
methods:
- uid: "com.azure.core.http.HttpRequest.copy()"
fullName: "com.azure.core.http.HttpRequest.copy()"
name: "copy()"
nameWithType: "HttpRequest.copy()"
summary: "Creates a copy of the request."
syntax: "public HttpRequest copy()"
desc: "Creates a copy of the request.\n\nThe main purpose of this is so that this HttpRequest can be changed and the resulting HttpRequest can be a backup. This means that the cloned HttpHeaders and body must not be able to change from side effects of this HttpRequest."
returns:
description: "a new HTTP request instance with cloned instances of all mutable properties."
type: ""
- uid: "com.azure.core.http.HttpRequest.getBody()"
fullName: "com.azure.core.http.HttpRequest.getBody()"
name: "getBody()"
nameWithType: "HttpRequest.getBody()"
summary: "Get the request content."
syntax: "public Flux getBody()"
desc: "Get the request content."
returns:
description: "the content to be sent"
type: "Flux<ByteBuffer>"
- uid: "com.azure.core.http.HttpRequest.getBodyAsBinaryData()"
fullName: "com.azure.core.http.HttpRequest.getBodyAsBinaryData()"
name: "getBodyAsBinaryData()"
nameWithType: "HttpRequest.getBodyAsBinaryData()"
summary: "Get the request content."
syntax: "public BinaryData getBodyAsBinaryData()"
desc: "Get the request content."
returns:
description: "the content to be sent"
type: ""
- uid: "com.azure.core.http.HttpRequest.getHeaders()"
fullName: "com.azure.core.http.HttpRequest.getHeaders()"
name: "getHeaders()"
nameWithType: "HttpRequest.getHeaders()"
summary: "Get the request headers."
syntax: "public HttpHeaders getHeaders()"
desc: "Get the request headers."
returns:
description: "headers to be sent"
type: ""
- uid: "com.azure.core.http.HttpRequest.getHttpMethod()"
fullName: "com.azure.core.http.HttpRequest.getHttpMethod()"
name: "getHttpMethod()"
nameWithType: "HttpRequest.getHttpMethod()"
summary: "Get the request method."
syntax: "public HttpMethod getHttpMethod()"
desc: "Get the request method."
returns:
description: "the request method"
type: ""
- uid: "com.azure.core.http.HttpRequest.getUrl()"
fullName: "com.azure.core.http.HttpRequest.getUrl()"
name: "getUrl()"
nameWithType: "HttpRequest.getUrl()"
summary: "Get the target address."
syntax: "public URL getUrl()"
desc: "Get the target address."
returns:
description: "the target address"
type: "URL"
- uid: "com.azure.core.http.HttpRequest.setBody(byte[])"
fullName: "com.azure.core.http.HttpRequest.setBody(byte[] content)"
name: "setBody(byte[] content)"
nameWithType: "HttpRequest.setBody(byte[] content)"
summary: "Set the request content."
parameters:
- description: "the request content"
name: "content"
type: "[]"
syntax: "public HttpRequest setBody(byte[] content)"
desc: "Set the request content.\n\nThe Content-Length header will be set based on the given content's length."
returns:
description: "this HttpRequest"
type: ""
- uid: "com.azure.core.http.HttpRequest.setBody(com.azure.core.util.BinaryData)"
fullName: "com.azure.core.http.HttpRequest.setBody(BinaryData content)"
name: "setBody(BinaryData content)"
nameWithType: "HttpRequest.setBody(BinaryData content)"
summary: "Set request content."
parameters:
- description: "the request content"
name: "content"
type: ""
syntax: "public HttpRequest setBody(BinaryData content)"
desc: "Set request content.\n\nIf provided content has known length, i.e. returns non-null then Content-Length header is updated. Otherwise, if provided content has unknown length, i.e. returns null then the caller must set the Content-Length header to indicate the length of the content, or use Transfer-Encoding: chunked."
returns:
description: "this HttpRequest"
type: ""
- uid: "com.azure.core.http.HttpRequest.setBody(java.lang.String)"
fullName: "com.azure.core.http.HttpRequest.setBody(String content)"
name: "setBody(String content)"
nameWithType: "HttpRequest.setBody(String content)"
summary: "Set the request content."
parameters:
- description: "the request content"
name: "content"
type: "String"
syntax: "public HttpRequest setBody(String content)"
desc: "Set the request content.\n\nThe Content-Length header will be set based on the given content's length."
returns:
description: "this HttpRequest"
type: ""
- uid: "com.azure.core.http.HttpRequest.setBody(reactor.core.publisher.Flux)"
fullName: "com.azure.core.http.HttpRequest.setBody(Flux content)"
name: "setBody(Flux content)"
nameWithType: "HttpRequest.setBody(Flux content)"
summary: "Set request content."
parameters:
- description: "the request content"
name: "content"
type: "Flux<ByteBuffer>"
syntax: "public HttpRequest setBody(Flux content)"
desc: "Set request content.\n\nCaller must set the Content-Length header to indicate the length of the content, or use Transfer-Encoding: chunked."
returns:
description: "this HttpRequest"
type: ""
- uid: "com.azure.core.http.HttpRequest.setHeader(com.azure.core.http.HttpHeaderName,java.lang.String)"
fullName: "com.azure.core.http.HttpRequest.setHeader(HttpHeaderName headerName, String value)"
name: "setHeader(HttpHeaderName headerName, String value)"
nameWithType: "HttpRequest.setHeader(HttpHeaderName headerName, String value)"
summary: "Set a request header, replacing any existing value."
parameters:
- description: "the header name"
name: "headerName"
type: ""
- description: "the header value"
name: "value"
type: "String"
syntax: "public HttpRequest setHeader(HttpHeaderName headerName, String value)"
desc: "Set a request header, replacing any existing value. A null for `value` will remove the header if one with matching name exists."
returns:
description: "this HttpRequest"
type: ""
- uid: "com.azure.core.http.HttpRequest.setHeader(java.lang.String,java.lang.String)"
fullName: "com.azure.core.http.HttpRequest.setHeader(String name, String value)"
name: "setHeader(String name, String value)"
nameWithType: "HttpRequest.setHeader(String name, String value)"
summary: "Set a request header, replacing any existing value."
deprecatedTag: "Use instead as is offers better performance."
parameters:
- description: "the header name"
name: "name"
type: "String"
- description: "the header value"
name: "value"
type: "String"
syntax: "@Deprecatedpublic HttpRequest setHeader(String name, String value)"
desc: "Set a request header, replacing any existing value. A null for `value` will remove the header if one with matching name exists."
hasDeprecatedTag: true
returns:
description: "this HttpRequest"
type: ""
- uid: "com.azure.core.http.HttpRequest.setHeaders(com.azure.core.http.HttpHeaders)"
fullName: "com.azure.core.http.HttpRequest.setHeaders(HttpHeaders headers)"
name: "setHeaders(HttpHeaders headers)"
nameWithType: "HttpRequest.setHeaders(HttpHeaders headers)"
summary: "Set the request headers."
parameters:
- description: "the set of headers"
name: "headers"
type: ""
syntax: "public HttpRequest setHeaders(HttpHeaders headers)"
desc: "Set the request headers."
returns:
description: "this HttpRequest"
type: ""
- uid: "com.azure.core.http.HttpRequest.setHttpMethod(com.azure.core.http.HttpMethod)"
fullName: "com.azure.core.http.HttpRequest.setHttpMethod(HttpMethod httpMethod)"
name: "setHttpMethod(HttpMethod httpMethod)"
nameWithType: "HttpRequest.setHttpMethod(HttpMethod httpMethod)"
summary: "Set the request method."
parameters:
- description: "the request method"
name: "httpMethod"
type: ""
syntax: "public HttpRequest setHttpMethod(HttpMethod httpMethod)"
desc: "Set the request method."
returns:
description: "this HttpRequest"
type: ""
- uid: "com.azure.core.http.HttpRequest.setUrl(java.lang.String)"
fullName: "com.azure.core.http.HttpRequest.setUrl(String url)"
name: "setUrl(String url)"
nameWithType: "HttpRequest.setUrl(String url)"
summary: "Set the target address to send the request to."
parameters:
- description: "target address as a String"
name: "url"
type: "String"
syntax: "public HttpRequest setUrl(String url)"
desc: "Set the target address to send the request to."
returns:
description: "this HttpRequest"
type: ""
- uid: "com.azure.core.http.HttpRequest.setUrl(java.net.URL)"
fullName: "com.azure.core.http.HttpRequest.setUrl(URL url)"
name: "setUrl(URL url)"
nameWithType: "HttpRequest.setUrl(URL url)"
summary: "Set the target address to send the request to."
parameters:
- description: "target address as "
name: "url"
type: "URL"
syntax: "public HttpRequest setUrl(URL url)"
desc: "Set the target address to send the request to."
returns:
description: "this HttpRequest"
type: ""
type: "class"
desc: "Represents an outgoing HTTP request.\n\nThis class encapsulates an HTTP request, including the HTTP method, URL, headers, and body. It provides methods to set and get these properties.\n\nThis class is useful when you want to create an HTTP request to send to a server. For example, you can use it to create a GET request to retrieve a resource, a POST request to create a resource, a PUT request to update a resource, or a DELETE request to delete a resource.\n\nNote: This class provides a method to create a copy of the HTTP request. This is useful when you want to modify the HTTP request without affecting the original request."
metadata: {}
package: "com.azure.core.http"
artifact: com.azure:azure-core:1.54.0