Skip to content

Commit 95cfd20

Browse files
authored
Remove unused store endpoint (#5446)
1 parent 76950aa commit 95cfd20

File tree

4 files changed

+0
-101
lines changed

4 files changed

+0
-101
lines changed

Sources/Sentry/SentryNSURLRequest.m

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,49 +19,6 @@
1919

2020
@implementation SentryNSURLRequest
2121

22-
- (_Nullable instancetype)initStoreRequestWithDsn:(SentryDsn *)dsn
23-
andEvent:(SentryEvent *)event
24-
didFailWithError:(NSError *_Nullable *_Nullable)error
25-
{
26-
NSDictionary *serialized = [event serialize];
27-
NSData *jsonData = [SentrySerialization dataWithJSONObject:serialized];
28-
if (nil == jsonData) {
29-
SENTRY_LOG_ERROR(@"Event cannot be converted to JSON");
30-
return nil;
31-
}
32-
33-
if ([SentrySDK.currentHub getClient].options.debug == YES) {
34-
SENTRY_LOG_DEBUG(@"Sending JSON -------------------------------");
35-
SENTRY_LOG_DEBUG(
36-
@"%@", [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]);
37-
SENTRY_LOG_DEBUG(@"--------------------------------------------");
38-
}
39-
return [self initStoreRequestWithDsn:dsn andData:jsonData didFailWithError:error];
40-
}
41-
42-
- (_Nullable instancetype)initStoreRequestWithDsn:(SentryDsn *)dsn
43-
andData:(NSData *)data
44-
didFailWithError:(NSError *_Nullable *_Nullable)error
45-
{
46-
NSURL *apiURL = [dsn getStoreEndpoint];
47-
self = [super initWithURL:apiURL
48-
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
49-
timeoutInterval:SentryRequestTimeout];
50-
if (self) {
51-
NSString *authHeader = newAuthHeader(dsn.url);
52-
53-
self.HTTPMethod = @"POST";
54-
[self setValue:authHeader forHTTPHeaderField:@"X-Sentry-Auth"];
55-
[self setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
56-
[self setValue:[NSString
57-
stringWithFormat:@"%@/%@", SentryMeta.sdkName, SentryMeta.versionString]
58-
forHTTPHeaderField:@"User-Agent"];
59-
[self setValue:@"gzip" forHTTPHeaderField:@"Content-Encoding"];
60-
self.HTTPBody = sentry_gzippedWithCompressionLevel(data, -1, error);
61-
}
62-
return self;
63-
}
64-
6522
- (_Nullable instancetype)initEnvelopeRequestWithDsn:(SentryDsn *)dsn
6623
andData:(NSData *)data
6724
didFailWithError:(NSError *_Nullable *_Nullable)error

Sources/Sentry/include/SentryNSURLRequest.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ NS_ASSUME_NONNULL_BEGIN
77

88
@interface SentryNSURLRequest : NSMutableURLRequest
99

10-
- (_Nullable instancetype)initStoreRequestWithDsn:(SentryDsn *)dsn
11-
andEvent:(SentryEvent *)event
12-
didFailWithError:(NSError *_Nullable *_Nullable)error;
13-
14-
- (_Nullable instancetype)initStoreRequestWithDsn:(SentryDsn *)dsn
15-
andData:(NSData *)data
16-
didFailWithError:(NSError *_Nullable *_Nullable)error;
17-
1810
- (_Nullable instancetype)initEnvelopeRequestWithDsn:(SentryDsn *)dsn
1911
andData:(NSData *)data
2012
didFailWithError:(NSError *_Nullable *_Nullable)error;

Tests/SentryTests/Networking/SentryDsnTests.m

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -20,45 +20,6 @@ - (void)testMissingUsernamePassword
2020
XCTAssertNil(options);
2121
}
2222

23-
- (void)testDsnHeaderUsernameAndPassword
24-
{
25-
NSError *error = nil;
26-
SentryDsn *dsn = [[SentryDsn alloc] initWithString:@"https://username:password@sentry.io/1"
27-
didFailWithError:&error];
28-
SentryNSURLRequest *request = [[SentryNSURLRequest alloc] initStoreRequestWithDsn:dsn
29-
andData:[NSData data]
30-
didFailWithError:&error];
31-
32-
NSString *authHeader =
33-
[[NSString alloc] initWithFormat:@"Sentry "
34-
@"sentry_version=7,sentry_client=sentry.cocoa/"
35-
@"%@,sentry_key=username,sentry_"
36-
@"secret=password",
37-
SentryMeta.versionString];
38-
39-
XCTAssertEqualObjects(request.allHTTPHeaderFields[@"X-Sentry-Auth"], authHeader);
40-
XCTAssertNil(error);
41-
}
42-
43-
- (void)testDsnHeaderUsername
44-
{
45-
NSError *error = nil;
46-
SentryDsn *dsn = [[SentryDsn alloc] initWithString:@"https://username@sentry.io/1"
47-
didFailWithError:&error];
48-
SentryNSURLRequest *request = [[SentryNSURLRequest alloc] initStoreRequestWithDsn:dsn
49-
andData:[NSData data]
50-
didFailWithError:&error];
51-
52-
NSString *authHeader =
53-
[[NSString alloc] initWithFormat:@"Sentry "
54-
@"sentry_version=7,sentry_client=sentry.cocoa/"
55-
@"%@,sentry_key=username",
56-
SentryMeta.versionString];
57-
58-
XCTAssertEqualObjects(request.allHTTPHeaderFields[@"X-Sentry-Auth"], authHeader);
59-
XCTAssertNil(error);
60-
}
61-
6223
- (void)testMissingScheme
6324
{
6425
NSError *error = nil;

Tests/SentryTests/SentryNSURLRequestTests.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,8 @@ class SentryNSURLRequestTests: XCTestCase {
1515
XCTAssert(string.hasSuffix("/envelope/"))
1616
}
1717

18-
func testRequestWithStoreEndpoint() throws {
19-
let request = try! SentryNSURLRequest(storeRequestWith: SentryNSURLRequestTests.dsn(), andData: Data())
20-
let string = try XCTUnwrap(request.url?.absoluteString as? NSString)
21-
XCTAssert(string.hasSuffix("/store/"))
22-
}
23-
2418
func testRequestWithEnvelopeEndpoint_hasUserAgentWithSdkNameAndVersion() {
2519
let request = try! SentryNSURLRequest(envelopeRequestWith: SentryNSURLRequestTests.dsn(), andData: Data())
2620
XCTAssertEqual(request.allHTTPHeaderFields?["User-Agent"], "\(SentryMeta.sdkName)/\(SentryMeta.versionString)")
2721
}
28-
29-
func testRequestWithStoreEndpoint_hasUserAgentWithSdkNameAndVersion() {
30-
let request = try! SentryNSURLRequest(storeRequestWith: SentryNSURLRequestTests.dsn(), andData: Data())
31-
XCTAssertEqual(request.allHTTPHeaderFields?["User-Agent"], "\(SentryMeta.sdkName)/\(SentryMeta.versionString)")
32-
}
3322
}

0 commit comments

Comments
 (0)