File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -70,14 +70,14 @@ export class RequestInformation {
70
70
return this . _requestOptions ;
71
71
}
72
72
/** Adds the headers for the request. */
73
- public addHeaders ( source : Record < string , string > ) {
73
+ public addRequestHeaders ( source : Record < string , string > | undefined ) {
74
74
if ( ! source ) return ;
75
75
for ( const key in source ) {
76
76
this . headers [ key ] = source [ key ] ;
77
77
}
78
78
}
79
79
/** Adds the request options for the request. */
80
- public addRequestOptions ( ... options : RequestOption [ ] ) {
80
+ public addRequestOptions ( options : RequestOption [ ] | undefined ) {
81
81
if ( ! options || options . length === 0 ) return ;
82
82
options . forEach ( ( option ) => {
83
83
this . _requestOptions [ option . getKey ( ) ] = option ;
@@ -137,7 +137,10 @@ export class RequestInformation {
137
137
* Sets the query string parameters from a raw object.
138
138
* @param parameters the parameters.
139
139
*/
140
- public setQueryStringParametersFromRawObject = ( q : object ) : void => {
140
+ public setQueryStringParametersFromRawObject = (
141
+ q : object | undefined
142
+ ) : void => {
143
+ if ( ! q ) return ;
141
144
Object . entries ( q ) . forEach ( ( [ k , v ] ) => {
142
145
let key = k ;
143
146
if ( ( q as any ) . getQueryParameter ) {
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ describe("RequestInformation", () => {
59
59
requestInformation . pathParameters [ "baseurl" ] = baseUrl ;
60
60
requestInformation . urlTemplate = "http://localhost/me{?%24select}" ;
61
61
const headers : Record < string , string > = { ConsistencyLevel : "eventual" } ;
62
- requestInformation . addHeaders ( headers ) ;
62
+ requestInformation . addRequestHeaders ( headers ) ;
63
63
assert . isNotEmpty ( requestInformation . headers ) ;
64
64
assert . equal ( "eventual" , requestInformation . headers [ "ConsistencyLevel" ] ) ;
65
65
} ) ;
You can’t perform that action at this time.
0 commit comments