Skip to content

Commit d303b71

Browse files
committed
Adding additionalHeaders property to OneSignalRequest
This property contains key value pairs for setting headers on a the urlRequest.
1 parent 77af655 commit d303b71

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

iOS_SDK/OneSignalSDK/Source/OneSignalRequest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
@property (nonatomic) HTTPMethod method;
3939
@property (strong, nonatomic, nonnull) NSString *path;
4040
@property (strong, nonatomic, nullable) NSDictionary *parameters;
41+
@property (strong, nonatomic, nullable) NSDictionary<NSString *, NSString *> *additionalHeaders;
4142
@property (nonatomic) int reattemptCount;
4243
@property (nonatomic) BOOL dataRequest; //false for JSON based requests
4344
-(BOOL)missingAppId; //for requests that don't require an appId parameter, the subclass should override this method and return false

iOS_SDK/OneSignalSDK/Source/OneSignalRequest.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ -(NSMutableURLRequest *)urlRequest {
6060

6161
let request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]];
6262

63+
for (NSString *key in self.additionalHeaders) {
64+
[request setValue:self.additionalHeaders[key] forHTTPHeaderField:key];
65+
}
66+
6367
if (!self.dataRequest)
6468
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
6569

0 commit comments

Comments
 (0)