From 1dba09b1603cd72e87b6c7f47ee0480d92fbefb9 Mon Sep 17 00:00:00 2001 From: Jamie Lynch Date: Tue, 23 Jan 2018 22:28:09 +0000 Subject: [PATCH] Add api key to payload body (#232) Add backwards compatibility for older versions of the error reporting API --- Source/BugsnagSink.m | 1 + Tests/BugsnagSinkTests.m | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/BugsnagSink.m b/Source/BugsnagSink.m index 34f462ab8..a95d95585 100644 --- a/Source/BugsnagSink.m +++ b/Source/BugsnagSink.m @@ -114,6 +114,7 @@ - (void)filterReports:(NSArray *)reports - (NSDictionary *)getBodyFromReports:(NSArray *)reports { NSMutableDictionary *data = [[NSMutableDictionary alloc] init]; BSGDictSetSafeObject(data, [Bugsnag notifier].details, BSGKeyNotifier); + BSGDictSetSafeObject(data, [Bugsnag notifier].configuration.apiKey, BSGKeyApiKey); NSMutableArray *formatted = [[NSMutableArray alloc] initWithCapacity:[reports count]]; diff --git a/Tests/BugsnagSinkTests.m b/Tests/BugsnagSinkTests.m index f28e41ee6..6cec07b87 100644 --- a/Tests/BugsnagSinkTests.m +++ b/Tests/BugsnagSinkTests.m @@ -53,7 +53,7 @@ - (void)tearDown { } - (void)testCorrectTopLevelKeys { - NSArray *expectedKeys = @[@"events", @"notifier"]; + NSArray *expectedKeys = @[@"apiKey", @"events", @"notifier"]; NSArray *topKeys = [self.processedData allKeys]; XCTAssertEqualObjects( [topKeys sortedArrayUsingSelector:@selector(compare:)], expectedKeys);