More actions
Created page with "=== WebResponse : The response object from a http request === ==== <span style="color:#a52a2a;">Constructors</span> ==== ==== <span style="color:#a52a2a;">Methods</span>..." |
No edit summary |
||
(8 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
== | {{CGscriptClass_Template | ||
|Name=<nowiki>WebResponse</nowiki> | |||
|Description=<nowiki>The response object from a http request</nowiki> | |||
|InheritsFrom=object|Methods= | |||
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>Response</nowiki>|Description=<nowiki>The response from the request</nowiki>}} | |||
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>Response</nowiki>|Parameters= | |||
{{CGscriptParameters_Template|Type=string|Name=<nowiki>encoding</nowiki>|Description=<nowiki>Encoding to use to read the reply - See .NET Encoding.GetEncoding for further info</nowiki>}} | |||
|Description=<nowiki>The response from the request with the encoding specified</nowiki>}} | |||
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}} | |||
|Properties= | |||
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>CharacterSet</nowiki>|HasGetter=1|Description=<nowiki>Gets the character set of the response.</nowiki>}} | |||
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ContentEncoding</nowiki>|HasGetter=1|Description=<nowiki>Gets the method that is used to encode the body of the response.</nowiki>}} | |||
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>ContentLength</nowiki>|HasGetter=1|Description=<nowiki>Gets the number of bytes of the content returned by the request.</nowiki>}} | |||
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ContentType</nowiki>|HasGetter=1|Description=<nowiki>Gets the content type of the response.</nowiki>}} | |||
{{CGscriptProperties_Template|ReturnType=Dictionary|Name=<nowiki>Headers</nowiki>|HasGetter=1|Description=<nowiki>Gets the headers that are associated with this response from the server.</nowiki>}} | |||
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>LastModified</nowiki>|HasGetter=1|Description=<nowiki>Gets the last date and time that the contents of the response were modified.</nowiki>}} | |||
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Method</nowiki>|HasGetter=1|Description=<nowiki>Gets the method that is used to return the response.</nowiki>}} | |||
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}} | |||
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>StatusCode</nowiki>|HasGetter=1|Description=<nowiki>Gets the status of the response.</nowiki>}} | |||
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>StatusDescription</nowiki>|HasGetter=1|Description=<nowiki>Gets the status description returned with the response.</nowiki>}} | |||
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}} | |||
}} | |||
'''More information about an HTTP Message:''' [http://www.jmarshall.com/easy/http/ http://www.jmarshall.com/easy/http/]<br> | |||
==== <span style="color:#a52a2a;">Examples</span> ==== | ==== <span style="color:#a52a2a;">Examples</span> ==== | ||
<span style="color: rgb(165, 42, 42);"><source lang="javascript">string uri = "http://google.com"; | |||
string responseString; | |||
HttpRequest hr = new HttpRequest(uri); | |||
WebResponse wr = hr.GetResponse(); | |||
responseString = wr.Response(); | |||
print(responseString);</source></span><br> |
Latest revision as of 09:32, 21 January 2020
WebResponse
The response object from a http request
Parent class
Inherits from object
Methods
- string Response() - The response from the request
- string Response(string encoding "Encoding to use to read the reply - See .NET Encoding.GetEncoding for further info") - The response from the request with the encoding specified
- (From object) string ToString() - The string representation of the object.
Properties
- string CharacterSet { get; } - Gets the character set of the response.
- string ContentEncoding { get; } - Gets the method that is used to encode the body of the response.
- number ContentLength { get; } - Gets the number of bytes of the content returned by the request.
- string ContentType { get; } - Gets the content type of the response.
- Dictionary Headers { get; } - Gets the headers that are associated with this response from the server.
- DateTime LastModified { get; } - Gets the last date and time that the contents of the response were modified.
- string Method { get; } - Gets the method that is used to return the response.
- string ObjectTypeName { get; } - The name of the type of object.
- int StatusCode { get; } - Gets the status of the response.
- string StatusDescription { get; } - Gets the status description returned with the response.
- (From object) TypeInformation TypeInformation { get; } - Get information about this class.
More information about an HTTP Message: http://www.jmarshall.com/easy/http/
Examples
string uri = "http://google.com";
string responseString;
HttpRequest hr = new HttpRequest(uri);
WebResponse wr = hr.GetResponse();
responseString = wr.Response();
print(responseString);