Skip to content

Commit

Permalink
refactor: use lowercase for charset (#483)
Browse files Browse the repository at this point in the history
* refactor: use lowercase for charset

* test: update charset for send update
  • Loading branch information
Fdawgs authored Nov 22, 2024
1 parent 0c5dfdd commit 9af3316
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ function getContentType (path) {
if (!send.isUtf8MimeType(type)) {
return type
}
return `${type}; charset=UTF-8`
return `${type}; charset=utf-8`
}

function findIndexFile (pathname, root, indexFiles = ['index.html']) {
Expand Down
12 changes: 6 additions & 6 deletions test/content-type.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test('register /content-type', t => {
url: 'http://localhost:' + fastify.server.address().port + '/content-type/index.html'
}, (err, response) => {
t.error(err)
t.equal(response.headers['content-type'], 'text/html; charset=UTF-8')
t.equal(response.headers['content-type'], 'text/html; charset=utf-8')
})
})

Expand All @@ -44,7 +44,7 @@ test('register /content-type', t => {
url: 'http://localhost:' + fastify.server.address().port + '/content-type/index.css'
}, (err, response) => {
t.error(err)
t.equal(response.headers['content-type'], 'text/css; charset=UTF-8')
t.equal(response.headers['content-type'], 'text/css; charset=utf-8')
})
})

Expand All @@ -66,7 +66,7 @@ test('register /content-type', t => {
url: 'http://localhost:' + fastify.server.address().port + '/content-type/test.txt'
}, (err, response) => {
t.error(err)
t.equal(response.headers['content-type'], 'text/plain; charset=UTF-8')
t.equal(response.headers['content-type'], 'text/plain; charset=utf-8')
})
})

Expand Down Expand Up @@ -111,7 +111,7 @@ test('register /content-type preCompressed', t => {
}
}, (err, response) => {
t.error(err)
t.equal(response.headers['content-type'], 'text/html; charset=UTF-8')
t.equal(response.headers['content-type'], 'text/html; charset=utf-8')
})
})

Expand All @@ -125,7 +125,7 @@ test('register /content-type preCompressed', t => {
}
}, (err, response) => {
t.error(err)
t.equal(response.headers['content-type'], 'text/css; charset=UTF-8')
t.equal(response.headers['content-type'], 'text/css; charset=utf-8')
})
})

Expand Down Expand Up @@ -153,7 +153,7 @@ test('register /content-type preCompressed', t => {
}
}, (err, response) => {
t.error(err)
t.equal(response.headers['content-type'], 'text/plain; charset=UTF-8')
t.equal(response.headers['content-type'], 'text/plain; charset=utf-8')
})
})

Expand Down
4 changes: 2 additions & 2 deletions test/static.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4017,7 +4017,7 @@ t.test('content-length in head route should not return zero when using wildcard'
}, (err, response, body) => {
t.error(err)
t.equal(response.statusCode, 200)
t.equal(response.headers['content-type'], 'text/html; charset=UTF-8')
t.equal(response.headers['content-type'], 'text/html; charset=utf-8')
t.equal(response.headers['content-length'], contentLength)
t.equal(body.toString(), '')
})
Expand Down Expand Up @@ -4055,7 +4055,7 @@ t.test('respect the .code when using with sendFile', t => {
}, (err, response, body) => {
t.error(err)
t.equal(response.statusCode, 404)
t.equal(response.headers['content-type'], 'text/html; charset=UTF-8')
t.equal(response.headers['content-type'], 'text/html; charset=utf-8')
t.equal(response.headers['content-length'], contentLength)
t.equal(body.toString(), '')
})
Expand Down

0 comments on commit 9af3316

Please sign in to comment.