Skip to content

Commit a2d3ae6

Browse files
committed
make sure we only set if defined
1 parent 8cc57de commit a2d3ae6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/core/src/fetch.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,12 @@ function getFetchSpanAttributes(
265265
attributes['http.url'] = parsedUrl.href;
266266
attributes['server.address'] = parsedUrl.host;
267267
}
268-
attributes['http.query'] = parsedUrl.search;
269-
attributes['http.fragment'] = parsedUrl.hash;
268+
if (parsedUrl.search) {
269+
attributes['http.query'] = parsedUrl.search;
270+
}
271+
if (parsedUrl.hash) {
272+
attributes['http.fragment'] = parsedUrl.hash;
273+
}
270274
}
271275
return attributes;
272276
}

0 commit comments

Comments
 (0)