Skip to content

HttpSendToFile - cHttpClient

Include: Use System\Http.pkg

Sends a custom HTTP method request and writes the response body to a file.

Type: Function

Return data type: HttpStatus, which is an alias for UShort

Parameters

Parameter Type Description
sMethod String HTTP method to send.
sPath String Relative path or absolute URL.
sFile String File path to create or truncate for the response body.
vBody Variant Request body. Strings are sent as text/plain, UChar[] values are sent as application/octet-stream, and structs/arrays/other Variant values are serialized to JSON as application/json unless sContentType or Content-Type overrides it.
sContentType String Optional content type. When omitted, cHttpClient selects a content type from the body value or uses the existing Content-Type request header.

Syntax

Function HttpSendToFile String sMethod String sPath String sFile {Variant vBody} {String sContentType} Returns HttpStatus

Call

Get HttpSendToFile of hoObj "REPORT" "/resource" "response.body" vBody to eStatus

Description

Use HttpSendToFile for HTTP methods not covered by the named helpers when the response bytes should be written directly to sFile.