Skip to content

Commit fc70752

Browse files
authored
ref: Unify method name casing in breadcrumbs (getsentry#2183)
1 parent a8b0dc1 commit fc70752

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/browser/src/integrations/breadcrumbs.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export class Breadcrumbs implements Integration {
249249
url: string;
250250
status_code?: number;
251251
} = {
252-
method,
252+
method: isString(method) ? method.toUpperCase() : method,
253253
url,
254254
};
255255

@@ -397,7 +397,7 @@ export class Breadcrumbs implements Integration {
397397
function(this: SentryWrappedXMLHttpRequest, ...args: any[]): void {
398398
const url = args[1];
399399
this.__sentry_xhr__ = {
400-
method: args[0],
400+
method: isString(args[0]) ? args[0].toUpperCase() : args[0],
401401
url: args[1],
402402
};
403403

packages/browser/test/integration/suites/breadcrumbs.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe("breadcrumbs", function() {
3232
function() {
3333
return runInSandbox(sandbox, { manual: true }, function() {
3434
var xhr = new XMLHttpRequest();
35-
xhr.open("GET", "/base/subjects/example.json");
35+
xhr.open("get", "/base/subjects/example.json");
3636
xhr.send();
3737
waitForXHR(xhr, function() {
3838
Sentry.captureMessage("test");
@@ -87,7 +87,9 @@ describe("breadcrumbs", function() {
8787

8888
it("should record a fetch request", function() {
8989
return runInSandbox(sandbox, { manual: true }, function() {
90-
fetch("/base/subjects/example.json")
90+
fetch("/base/subjects/example.json", {
91+
method: "Get",
92+
})
9193
.then(
9294
function() {
9395
Sentry.captureMessage("test");

0 commit comments

Comments
 (0)