Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
ui-middleware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
OX App Suite
Core
ui-middleware
Commits
e785c241
Commit
e785c241
authored
1 year ago
by
david.bauer
Browse files
Options
Downloads
Patches
Plain Diff
Change: Explicitly set content-type to utf-8 for javascript files
parent
63505fcb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
spec/app_root_test.js
+1
-1
1 addition, 1 deletion
spec/app_root_test.js
spec/file_caching_test.js
+3
-3
3 additions, 3 deletions
spec/file_caching_test.js
src/files.js
+1
-1
1 addition, 1 deletion
src/files.js
with
5 additions
and
5 deletions
spec/app_root_test.js
+
1
−
1
View file @
e785c241
...
...
@@ -51,7 +51,7 @@ describe('With different app root', function () {
it
(
'
serves files defined in manifest.json file
'
,
async
function
()
{
const
response
=
await
app
.
inject
({
url
:
'
/appsuite/example.js
'
})
expect
(
response
.
statusCode
).
to
.
equal
(
200
)
expect
(
response
.
headers
[
'
content-type
'
]).
to
.
equal
(
'
application/javascript
'
)
expect
(
response
.
headers
[
'
content-type
'
]).
to
.
equal
(
'
application/javascript
; charset=utf-8
'
)
expect
(
response
.
body
).
to
.
equal
(
'
this is example
'
)
const
response2
=
await
app
.
inject
({
url
:
'
/appsuite/test.txt
'
})
...
...
This diff is collapsed.
Click to expand it.
spec/file_caching_test.js
+
3
−
3
View file @
e785c241
...
...
@@ -66,7 +66,7 @@ describe('File caching service', function () {
it
(
'
serves files defined in manifest.json file
'
,
async
function
()
{
const
response
=
await
app
.
inject
({
url
:
'
/example.js
'
})
expect
(
response
.
statusCode
).
to
.
equal
(
200
)
expect
(
response
.
headers
[
'
content-type
'
]).
to
.
equal
(
'
application/javascript
'
)
expect
(
response
.
headers
[
'
content-type
'
]).
to
.
equal
(
'
application/javascript
; charset=utf-8
'
)
expect
(
response
.
body
).
to
.
equal
(
'
this is example
'
)
// expect(response.headers['content-security-policy']).to.contain('sha256-NzZhMTE2Njc2YTgyNTZmZTdlZGVjZDU3YTNmYzRjNmM1OWZkMTI2NjRkYzZmMWM3YTkwMGU3ZTdhNDlhZmVlMwo=')
const
response2
=
await
app
.
inject
({
url
:
'
/test.txt
'
})
...
...
@@ -113,7 +113,7 @@ describe('File caching service', function () {
'
http://ui-server
'
:
{
'
/manifest.json
'
:
generateSimpleViteManifest
({}),
'
/example.js
'
:
spy
=
sandbox
.
spy
(()
=>
{
return
new
Response
(
'
this is example
'
,
{
headers
:
{
'
content-type
'
:
'
application/javascript
'
}
})
return
new
Response
(
'
this is example
'
,
{
headers
:
{
'
content-type
'
:
'
application/javascript
; charset=utf-8
'
}
})
})
}
})
...
...
@@ -134,7 +134,7 @@ describe('File caching service', function () {
'
http://ui-server
'
:
{
'
/manifest.json
'
:
generateSimpleViteManifest
({}),
'
/example.js
'
:
spy
=
sandbox
.
spy
(()
=>
{
return
new
Response
(
'
this is example
'
,
{
headers
:
{
'
content-type
'
:
'
application/javascript
'
}
})
return
new
Response
(
'
this is example
'
,
{
headers
:
{
'
content-type
'
:
'
application/javascript
; charset=utf-8
'
}
})
})
}
})
...
...
This diff is collapsed.
Click to expand it.
src/files.js
+
1
−
1
View file @
e785c241
...
...
@@ -38,7 +38,7 @@ export async function fetchFileWithHeadersFromBaseUrl ({ path, baseUrl, version
const
result
=
{
body
:
Buffer
.
from
(
await
response
.
arrayBuffer
()),
headers
:
{
'
content-type
'
:
response
.
headers
.
get
(
'
content-type
'
),
'
content-type
'
:
response
.
headers
.
get
(
'
content-type
'
)
===
'
application/javascript
'
?
'
application/javascript; charset=utf-8
'
:
response
.
headers
.
get
(
'
content-type
'
),
dependencies
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment