playwright/tests/assets/network-tab/network.html
Kuba Janik a6b320e362
fix(ui-mode): format request body when headers are lower case (#32395)
Resolves https://github.com/microsoft/playwright/issues/32396

Currently, the request body is not formatted when content type header is
lower case (`content-type`). Even though the value is
`application/json`.

It happens because we are looking only for `Content-Type` header
ignoring headers that are lower case.

<img width="674" alt="363197933-5178ec23-b9cf-46b5-8284-e8d4d730b036"
src="https://github.com/user-attachments/assets/0ef01b52-7dd8-4f33-b836-9adb86f94cc9">
2024-08-30 16:21:51 +02:00

41 lines
853 B
HTML

<html>
<head>
<link rel='stylesheet' href='style.css'>
<style>
@font-face {
font-family: 'font';
src: url('font.woff2') format('woff2');
}
body {
font-family: 'font';
}
</style>
<script src='script.js'></script>
<script>fetch('/api/endpoint')</script>
<script>
const body = JSON.stringify({
data: {
key: 'value',
array: ['value-1', 'value-2'],
},
});
fetch('/post-data-1', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body,
});
fetch('/post-data-2', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body,
});
</script>
</head>
<body>
<h1>Network Tab Test</h1>
<img src="image.png" >
</body>
</html>