Skip to content

Commit 96ebbfe

Browse files
Merge pull request #33 from contentstack/hotfix/switch_stack
fix: fixed switching stack issue
2 parents a49f0e7 + 8391a36 commit 96ebbfe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2012-2023 Contentstack
3+
Copyright (c) 2012-2024 Contentstack
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Sources/Stack.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ public class Stack: CachePolicyAccessible {
6969
}
7070

7171
var contentstackHTTPHeaders: [AnyHashable: Any] = [
72-
"api_key": apiKey,
73-
"access_token": deliveryToken,
7472
"X-User-Agent": config.sdkVersionString(),
7573
"User-Agent": config.userAgentString()
7674
]
@@ -194,6 +192,8 @@ public class Stack: CachePolicyAccessible {
194192
private func fetchUrl(_ url: URL, headers:[String: String], cachePolicy: CachePolicy, then completion: @escaping ResultsHandler<Data>) {
195193
var dataTask: URLSessionDataTask?
196194
var request = URLRequest(url: url)
195+
request.setValue(self.deliveryToken, forHTTPHeaderField: "access_token")
196+
request.setValue(self.apiKey, forHTTPHeaderField: "api_key")
197197
for header in headers {
198198
request.addValue(header.value, forHTTPHeaderField: header.key)
199199
}

0 commit comments

Comments
 (0)