Skip to main content
namespace ML.SDK
Class | Sealed

MLHttpClient


namespace ML.SDK
{
sealed class MLHttpClient
}

Summary

The HttpClient class simplifies HTTP communication in the Massive Loop, offering a set of features for sending requests and handling responses.

Properties

PropertyDesciption
UseCookiesEnables the client to store cookies set by web servers and use them when sending subsequent web requests.
UseDefaultHeadersUses the default headers if set to true. Default headers: User-Agent: Mozilla/5.0 AppleWebKit/537.36 Chrome/42.0.2311.135 Safari/537.36 Edge/12.246 Content-Type: application/json Cache-Control: no-cache
UseDefaultUserAgentSets a default user agent to the client. The default user agent is: Mozilla/5.0 AppleWebKit/537.36 Chrome/42.0.2311.135 Safari/537.36 Edge/12.246

Constructors

ConstructorDescription
MLHttpClient()Creates a new MLHttpClient .

Methods

MethodDescription
AddCookie(string, string, string)Add a new cookie to the list of cookies used by the Http Client.
AddCustomUserAgent(string)Add a new custom user agent. The user agent needs to be in proper format of ProductName/ProductVersion
AddUserAgentProductInfo(string, string)Adds a new user agent with product name and product version.
ClearUserAgent()Clears the current User Agent header.
GetCookies(string)Returns a dictionary of cookies currently set in the Http client for the specific domain.
AddHeader(string, string)Adds a default request header to the client.
RemoveHeader(string)Removes a default header from client.
WebRequest(string, HttpMethod, Dictionary<string, string>)Sends a new Wen Request with no content. A URL, HTTP Method are required. Extra headers may be provided.
WebRequest(string, HttpMethod, string, Dictionary<string, string>)Sends a new Wen Request with Json content. A URL, HTTP Method and a string content are required. Extra headers may be provided.
WebRequest(string, HttpMethod, byte[], Dictionary<string, string>)Sends a new Web Request with a byte array content. A URL, HTTP Method and a byte array are required. Extra headers may be provided.