Skip to content

Commit 1d5a6f4

Browse files
committed
Fix registerPush and unregisterPush Content-Type header
Set Content-Type to application/json for registerPush and unregisterPush endpoints. Previously, contentTypeValue was set to nil, which caused the Content-Type header to not be set at all. This resulted in PDS rejecting requests with "Wrong request encoding" error. The request body was already being JSON-encoded (via toJsonData()), but without the Content-Type header, the server couldn't properly handle the request. Fixes the issue where push notification registration would fail with 400 Bad Request.
1 parent f9b0cb8 commit 1d5a6f4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Sources/ATProtoKit/APIReference/AppBskyAPI/AppBskyNotificationRegisterPushMethod.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ extension ATProtoKit {
6363
forRequest: requestURL,
6464
andMethod: .post,
6565
acceptValue: "application/json",
66-
contentTypeValue: nil,
66+
contentTypeValue: "application/json",
6767
authorizationValue: "Bearer \(accessToken)"
6868
)
6969

Sources/ATProtoKit/APIReference/AppBskyAPI/AppBskyNotificationUnregisterPushMethod.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ extension ATProtoKit {
6161
forRequest: requestURL,
6262
andMethod: .post,
6363
acceptValue: "application/json",
64-
contentTypeValue: nil,
64+
contentTypeValue: "application/json",
6565
authorizationValue: "Bearer \(accessToken)"
6666
)
6767

0 commit comments

Comments
 (0)