Difference between revisions of "StatusLine (HttpResponse function)"

From m204wiki
Jump to navigation Jump to search
m
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span>
+
{{Template:HttpResponse:StatusLine subtitle}}
[[Category:HttpResponse methods|StatusLine property]]
+
The <var>StatusLine</var> method lets you check the HTTP status line of the result of the most recent <var>[[Get (HttpRequest function)|Get]]</var>, <var>[[Post (HttpRequest function)|Post]]</var>, or <var>[[Send (HttpRequest function)|Send]]</var> operation. <var>StatusLine</var> returns the whole HTTP status line, which consists of a code, a blank, and a message (for example, "200 OK").
<p>
 
<var>StatusLine</var> is a member of the <var>[[HttpResponse class|HttpResponse]]</var> class.
 
</p>
 
  
This method lets you check the HTTP status line of the
 
result of the most recent <var>[[Get (HttpRequest function)|Get]]</var>, <var>[[Post (HttpRequest function)|Post]]</var>, or <var>[[Send (HttpRequest function)|Send]]</var> operation.
 
<var>StatusLine</var> returns the whole HTTP status line, which consists of
 
a code, a blank, and a message (for example, "200 OK").
 
 
==Syntax==
 
==Syntax==
<p class="syntax">%statusline = %httpresp:StatusLine
+
{{Template:HttpResponse:StatusLine syntax}}
</p>
 
 
 
 
===Syntax terms===
 
===Syntax terms===
 
<table class="syntaxTable">
 
<table class="syntaxTable">
<tr><th>%statusline</th>
+
<tr><th>%string</th>
<td>A string or longstring variable for the assignment of the StatusLine value of ''%httpresp''.
+
<td>A string or <var>[[Longstrings|longstring]]</var> variable for the assignment of the StatusLine value of <var class="term">httpResponse</var>.
 
</td></tr>
 
</td></tr>
<tr><th>%httpresp</th>
+
<tr><th>httpResponse</th>
<td>A reference to an HTTPResponse object that was returned by a Get, Post, or Send method of an HTTPRequest object.
+
<td>A reference to an <var>[[HttpResponse_class|HttpResponse]]</var> object that was returned by a <var>Get</var>, <var>Post</var>, or <var>Send</var> method of an <var>[[HttpRequest_class|HttpRequest]]</var> object.</td></tr>
 +
</table>
 +
 
 +
The StatusLine function is critical to handling web redirects.
 +
 
 +
<p class="code">%resp      is object httpResponse               
 +
...                                                 
 +
if %resp:statusLine:word(1) eq '302' then         
 +
  ...
 +
end if                                           
 +
</p>
  
</td></tr></table>
+
==See also==
 +
{{Template:HttpResponse:StatusLine footer}}

Latest revision as of 15:45, 3 December 2013

Status line of most recent request (HttpResponse class)

The StatusLine method lets you check the HTTP status line of the result of the most recent Get, Post, or Send operation. StatusLine returns the whole HTTP status line, which consists of a code, a blank, and a message (for example, "200 OK").

Syntax

%string = httpResponse:StatusLine

Syntax terms

%string A string or longstring variable for the assignment of the StatusLine value of httpResponse.
httpResponse A reference to an HttpResponse object that was returned by a Get, Post, or Send method of an HttpRequest object.

The StatusLine function is critical to handling web redirects.

%resp is object httpResponse ... if %resp:statusLine:word(1) eq '302' then ... end if

See also