Skip to content

Commit a3fa945

Browse files
committed
Changed response to /eventsub/subscriptions; Fixes #226
1 parent d10cf02 commit a3fa945

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

internal/events/websocket/mock_server/manager.go

+15-13
Original file line numberDiff line numberDiff line change
@@ -397,19 +397,21 @@ func subscriptionPageHandlerPost(w http.ResponseWriter, r *http.Request) {
397397
w.WriteHeader(http.StatusAccepted)
398398

399399
json.NewEncoder(w).Encode(&SubscriptionPostSuccessResponse{
400-
Body: SubscriptionPostSuccessResponseBody{
401-
ID: subscription.SubscriptionID,
402-
Status: subscription.Status,
403-
Type: subscription.Type,
404-
Version: subscription.Version,
405-
Condition: EmptyStruct{},
406-
CreatedAt: subscription.CreatedAt,
407-
Transport: SubscriptionTransport{
408-
Method: "websocket",
409-
SessionID: fmt.Sprintf("%v_%v", server.ServerId, clientName),
410-
ConnectedAt: client.ConnectedAtTimestamp,
400+
Data: []SubscriptionPostSuccessResponseBody{
401+
{
402+
ID: subscription.SubscriptionID,
403+
Status: subscription.Status,
404+
Type: subscription.Type,
405+
Version: subscription.Version,
406+
Condition: EmptyStruct{},
407+
CreatedAt: subscription.CreatedAt,
408+
Transport: SubscriptionTransport{
409+
Method: "websocket",
410+
SessionID: fmt.Sprintf("%v_%v", server.ServerId, clientName),
411+
ConnectedAt: client.ConnectedAtTimestamp,
412+
},
413+
Cost: 0,
411414
},
412-
Cost: 0,
413415
},
414416
Total: 0,
415417
MaxTotalCost: 10,
@@ -519,7 +521,7 @@ func handlerResponseErrorUnauthorized(w http.ResponseWriter, message string) {
519521
func handlerResponseErrorConflict(w http.ResponseWriter, message string) {
520522
w.WriteHeader(http.StatusConflict)
521523
bytes, _ := json.Marshal(&SubscriptionPostErrorResponse{
522-
Error: "Unauthorized",
524+
Error: "Conflict",
523525
Message: message,
524526
Status: 409,
525527
})

internal/events/websocket/mock_server/subscription.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type SubscriptionPostRequestTransport struct {
2727

2828
// Response (Success) - POST /eventsub/subscriptions
2929
type SubscriptionPostSuccessResponse struct {
30-
Body SubscriptionPostSuccessResponseBody `json:"body"`
30+
Data []SubscriptionPostSuccessResponseBody `json:"data"`
3131

3232
Total int `json:"total"`
3333
MaxTotalCost int `json:"max_total_cost"`

0 commit comments

Comments
 (0)