Skip to content

Commit a4a73cd

Browse files
committed
Refactor header handling in _sendRequestAndWaitResponse function for clarity
1 parent cb251bd commit a4a73cd

File tree

2 files changed

+30
-33
lines changed

2 files changed

+30
-33
lines changed

Project/Sources/Classes/Office365Category.4dm

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,37 @@ Class extends _GraphAPI
33
property userId : Text:=""
44

55
Class constructor($inProvider : cs.OAuth2Provider; $inParameters : Object)
6-
7-
Super($inProvider)
8-
This.userId:=(Length(String($inParameters.userId))>0) ? String($inParameters.userId) : ""
9-
10-
6+
7+
Super($inProvider)
8+
This.userId:=(Length(String($inParameters.userId))>0) ? String($inParameters.userId) : ""
9+
10+
1111
// Mark: - [Public]
12-
// ----------------------------------------------------
13-
14-
12+
// ----------------------------------------------------
13+
14+
1515
Function list : cs.GraphCategoryList
16-
16+
1717
/*
1818
GET /me/outlook/masterCategories
1919
GET /users/{id|userPrincipalName}/outlook/masterCategories
2020
*/
21-
Super._clearErrorStack()
22-
Super._throwErrors(False)
23-
24-
var $headers : Object:={}
25-
var $urlParams : Text:=""
26-
27-
If (Length(String(This.userId))>0)
28-
$urlParams:="users/"+This.userId
29-
Else
30-
$urlParams:="me"
31-
End if
32-
$urlParams+="/outlook/masterCategories"+Super._getURLParamsFromObject($inParameters)
33-
34-
If ((Value type($inParameters.search)=Is text) && (Length(String($inParameters.search))>0))
35-
$headers.ConsistencyLevel:="eventual"
36-
End if
37-
38-
var $URL : Text:=This._getURL()+$urlParams
39-
var $result : cs.GraphCategoryList:=cs.GraphCategoryList.new(This._getOAuth2Provider(); $URL; $headers)
40-
41-
Super._throwErrors(True)
42-
43-
return $result
21+
Super._clearErrorStack()
22+
Super._throwErrors(False)
23+
24+
var $headers : Object:={}
25+
var $urlParams : Text:=""
26+
27+
If (Length(String(This.userId))>0)
28+
$urlParams:="users/"+This.userId
29+
Else
30+
$urlParams:="me"
31+
End if
32+
$urlParams+="/outlook/masterCategories"
33+
34+
var $URL : Text:=This._getURL()+$urlParams
35+
var $result : cs.GraphCategoryList:=cs.GraphCategoryList.new(This._getOAuth2Provider(); $URL; $headers)
36+
37+
Super._throwErrors(True)
38+
39+
return $result

Project/Sources/Classes/_BaseAPI.4dm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ Function _sendRequestAndWaitResponse($inMethod : Text; $inURL : Text; $inHeaders
120120

121121
: ($contentType="multipart/@")
122122
var $headers : Text:="HTTP/1.1 "+This._internals._statusLine+"\r\n"
123-
$keys:=OB Keys($request.response.headers)
123+
var $keys : Collection:=OB Keys($request.response.headers)
124+
var $key : Text
124125
For each ($key; $keys)
125126
$headers+=$key+": "+$request.response.headers[$key]+"\r\n"
126127
End for each

0 commit comments

Comments
 (0)