-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSAMPLE_HTTP.SMD
More file actions
53 lines (45 loc) · 1.02 KB
/
SAMPLE_HTTP.SMD
File metadata and controls
53 lines (45 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
INCLUDES BEGIN
INCLUDE_HTTP
END
CONSTANTS begin
end
CODE BEGIN
//{{CODEBEGIN
main
begin
testQueryParameter();
end
private testQueryParameter
objects
begin
Request as cRequest
end
begin
Request.reset();
Request.Url = "http://uinames.com/api/";
Request.Method = HttpTypes.GET_METHOD;
Request.addQueryParameter( "region", "spain" );
Request.addQueryParameter( "ext", "" );
Request.send();
Request.Response.Trace();
end
private testBasicAuth
objects
begin
Request as cRequest
end
begin
Request.reset();
Request.Url = "https://jigsaw.w3.org/HTTP/Basic/";
Request.addBasicAuthHeader( "guest", "guest" );
Request.Method = HttpTypes.GET_METHOD;
Request.send();
switch Request.StatusResponse
begin
case HttpTypes.HTTP_200_OK: "Login Ok".Trace();
case HttpTypes.HTTP_401_UNAUTHORIZED: "Unauthorized".Trace();
default: "Unknown response".Trace();
end
end
//{{CODEEND
END