Skip to content

Commit bcd5408

Browse files
authored
Merge pull request #29 from Benno-Wu/patch-1
fix: support type number in headers
2 parents 55bd78d + 5781d57 commit bcd5408

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

apps/koa/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"vitest": "^1.5.0"
2828
},
2929
"dependencies": {
30-
"axios": "^1.6.8",
30+
"axios": "^0.27.2",
3131
"cross-env": "^7.0.3",
3232
"koa": "^2.15.3",
3333
"koa-body": "^6.0.1",

apps/koa/src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ const run = () => {
9090
const res = await axios.get('http://www.baidu.com')
9191
ctx.body = res.data
9292
})
93+
router.get('/headerWithNumber', async (ctx) => {
94+
const res = await axios.get('http://www.baidu.com', {
95+
headers: { 'test-timestamp': Date.now() }
96+
})
97+
ctx.body = res.data
98+
})
9399

94100
router.get('/fetch', async (ctx) => {
95101
const res = await fetch('https://jsonplaceholder.typicode.com/posts')

packages/network-debugger/src/fork/devtool.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ export class DevtoolServer {
159159
const headerPipe = new RequestHeaderPipe(request.requestHeaders)
160160
const contentType = headerPipe.getHeader('content-type')
161161

162+
for (let key in request.requestHeaders){
163+
if(typeof request.requestHeaders[key] === 'number'){
164+
request.requestHeaders[key] = String(request.requestHeaders[key])
165+
}
166+
}
167+
162168
return this.send({
163169
method: 'Network.requestWillBeSent',
164170
params: {

0 commit comments

Comments
 (0)