EchoVib

MockHttpResponse (Azure SDK for Java Reference Documentation)

MockHttpResponse (Azure SDK for Java Reference Documentation)
  • java.lang.Object
    • com.azure.core.http.HttpResponse
      • com.azure.core.test.http.MockHttpResponse
  • All Implemented Interfaces: Closeable, AutoCloseable
    public class MockHttpResponse extends com.azure.core.http.HttpResponse

    An HTTP response that is created to simulate a HTTP request.

    • Constructor Summary

      Constructors 
      Constructor and Description
      MockHttpResponse(com.azure.core.http.HttpRequest request, int statusCode)

      Creates a HTTP response associated with a request, returns the statusCode, and has an empty response body.

      MockHttpResponse(com.azure.core.http.HttpRequest request, int statusCode, byte[] bodyBytes)

      Creates an HTTP response associated with a request, returns the statusCode, and response body of bodyBytes.

      MockHttpResponse(com.azure.core.http.HttpRequest request, int statusCode, com.azure.core.http.HttpHeaders headers)

      Creates an HTTP response associated with a request, returns the statusCode, and http headers.

      MockHttpResponse(com.azure.core.http.HttpRequest request, int statusCode, com.azure.core.http.HttpHeaders headers, byte[] bodyBytes)

      Creates an HTTP response associated with a request, returns the statusCode, contains the headers, and response body of bodyBytes.

      MockHttpResponse(com.azure.core.http.HttpRequest request, int statusCode, com.azure.core.http.HttpHeaders headers, Object serializable)

      Creates an HTTP response associated with a request, returns the statusCode, contains the given headers, and response body that is JSON serialized from serializable.

      MockHttpResponse(com.azure.core.http.HttpRequest request, int statusCode, Object serializable)

      Creates an HTTP response associated with a request, returns the statusCode, and response body that is JSON serialized from serializable.

    • Constructor Detail

      • MockHttpResponse

        public MockHttpResponse(com.azure.core.http.HttpRequest request, int statusCode)

        Creates a HTTP response associated with a request, returns the statusCode, and has an empty response body.

        Parameters: request - HttpRequest associated with the response. statusCode - Status code of the response.
      • MockHttpResponse

        public MockHttpResponse(com.azure.core.http.HttpRequest request, int statusCode, byte[] bodyBytes)

        Creates an HTTP response associated with a request, returns the statusCode, and response body of bodyBytes.

        Parameters: request - HttpRequest associated with the response. statusCode - Status code of the response. bodyBytes - Contents of the response.
      • MockHttpResponse

        public MockHttpResponse(com.azure.core.http.HttpRequest request, int statusCode, com.azure.core.http.HttpHeaders headers)

        Creates an HTTP response associated with a request, returns the statusCode, and http headers.

        Parameters: request - HttpRequest associated with the response. statusCode - Status code of the response. headers - Headers of the response.
      • MockHttpResponse

        public MockHttpResponse(com.azure.core.http.HttpRequest request, int statusCode, com.azure.core.http.HttpHeaders headers, byte[] bodyBytes)

        Creates an HTTP response associated with a request, returns the statusCode, contains the headers, and response body of bodyBytes.

        Parameters: request - HttpRequest associated with the response. statusCode - Status code of the response. headers - HttpHeaders of the response. bodyBytes - Contents of the response.
      • MockHttpResponse

        public MockHttpResponse(com.azure.core.http.HttpRequest request, int statusCode, com.azure.core.http.HttpHeaders headers, Object serializable)

        Creates an HTTP response associated with a request, returns the statusCode, contains the given headers, and response body that is JSON serialized from serializable.

        Parameters: request - HttpRequest associated with the response. headers - HttpHeaders of the response. statusCode - Status code of the response. serializable - Contents to be serialized into JSON for the response.
      • MockHttpResponse

        public MockHttpResponse(com.azure.core.http.HttpRequest request, int statusCode, Object serializable)

        Creates an HTTP response associated with a request, returns the statusCode, and response body that is JSON serialized from serializable.

        Parameters: request - HttpRequest associated with the response. statusCode - Status code of the response. serializable - Contents to be serialized into JSON for the response.
    • Method Detail

      • addHeader

        public MockHttpResponse addHeader(String name, String value)

        Adds the header name and value to the existing set of HTTP headers.

        Parameters: name - The header to add value - The header value. Returns: The updated response object.

Copyright © 2020 Microsoft Corporation. All rights reserved.

ncG1vNJzZmiZqqq%2Fpr%2FDpJuom6Njr627wWeaqKqVY8SqusOorqxmnprBcHDWnploopGrrnCt2a6pnmWTpL%2BmedOeqq1nYWN%2Bb3yOnKamZ5GvwrOxjpymq51fqbK0wI6hq62oX4K8pLenraupipWovbC60p5loaydoQ%3D%3D

Jenniffer Sheldon

Update: 2024-06-20