The adapter will report the text body of a successful HTTP request to the specified url, or return an error if the response status code is greater than or equal to 400.

Input: None

Returns: String representation of the http response.

Example: Basic HttpTask

{"httpTask": {"url": "https://mywebsite.org/path"} }

Example: HttpTask example with headers

{ "httpTask": { "url": "https://mywebsite.org/path", "method": "METHOD_POST", "headers": [ { "key": "MY_HEADER_KEY", "value": "MY_HEADER_VALUE" } ], "body": "{\"MY_BODY_KEY\":\"MY_BODY_VALUE\"}" } }

Implements

Constructors

  • Constructs a new HttpTask.

    Parameters

    • Optional properties: IHttpTask

      Properties to set

    Returns HttpTask

Properties

body: string

A stringified body (if any) to add to this HttpTask.

headers: IHeader[]

A list of headers to add to this HttpTask.

The type of HTTP request to make.

url: string

A string containing the URL to direct this HTTP request to.

Methods

  • Converts this HttpTask to JSON.

    Returns {
        [k: string]: any;
    }

    JSON object

    • [k: string]: any
  • Creates a new HttpTask instance using the specified properties.

    Parameters

    • Optional properties: IHttpTask

      Properties to set

    Returns HttpTask

    HttpTask instance

  • Decodes a HttpTask message from the specified reader or buffer.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    • Optional length: number

      Message length if known beforehand

    Returns HttpTask

    HttpTask

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Decodes a HttpTask message from the specified reader or buffer, length delimited.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    Returns HttpTask

    HttpTask

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Encodes the specified HttpTask message. Does not implicitly verify messages.

    Parameters

    • message: IHttpTask

      HttpTask message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Encodes the specified HttpTask message, length delimited. Does not implicitly verify messages.

    Parameters

    • message: IHttpTask

      HttpTask message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Creates a HttpTask message from a plain object. Also converts values to their respective internal types.

    Parameters

    • object: {
          [k: string]: any;
      }

      Plain object

      • [k: string]: any

    Returns HttpTask

    HttpTask

  • Gets the default type url for HttpTask

    Parameters

    • Optional typeUrlPrefix: string

      your custom typeUrlPrefix(default "type.googleapis.com")

    Returns string

    The default type url

  • Creates a plain object from a HttpTask message. Also converts values to other types if specified.

    Parameters

    • message: HttpTask

      HttpTask

    • Optional options: IConversionOptions

      Conversion options

    Returns {
        [k: string]: any;
    }

    Plain object

    • [k: string]: any
  • Verifies a HttpTask message.

    Parameters

    • message: {
          [k: string]: any;
      }

      Plain object to verify

      • [k: string]: any

    Returns string

    null if valid, otherwise the reason why it is not