send


Description:

[ Version ( since = "2.42" ) ]
public InputStream send (Message msg, Cancellable? cancellable = null) throws Error

Synchronously sends msg and waits for the beginning of a response.

On success, a InputStream will be returned which you can use to read the response body. ("Success" here means only that an HTTP response was received and understood; it does not necessarily mean that a 2xx class status code was received.)

If non-%NULL, cancellable can be used to cancel the request; send will return a CANCELLED error. Note that with requests that have side effects (eg, POST, PUT, DELETE ) it is possible that you might cancel the request after the server acts on it, but before it returns a response, leaving the remote resource in an unknown state.

If msg is requeued due to a redirect or authentication, the initial (3xx/401/407) response body will be suppressed, and send will only return once a final response has been received.

Contrast this method with send_message, which also synchronously sends a Message, but doesn't return until the response has been completely read.

(Note that this method cannot be called on the deprecated SessionAsync subclass.)

Parameters:

this

a Session

msg

a Message

cancellable

a Cancellable

Returns:

a InputStream for reading the response body, or null on error.




2022 vala-language.org