Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
SemWeb
libview
Commits
f29feaac2615
Commit
3e1df632
authored
Feb 07, 2020
by
Laurent Wouters
Browse files
Fix accept header when negotiating content
parent
c013e8ebf692
Changes
2
Hide whitespace changes
Inline
Side-by-side
extension/package.json
View file @
f29feaac
...
...
@@ -30,7 +30,6 @@
"react-dom"
:
"^16.2.0"
},
"devDependencies"
:
{
"@types/chai"
:
"^4.1.7"
,
"@types/chrome"
:
"0.0.69"
,
"@types/mocha"
:
"^5.2.5"
,
"@types/node"
:
"10.11.0"
,
...
...
@@ -38,7 +37,6 @@
"@types/react"
:
"^16.4.6"
,
"@types/react-dom"
:
"^16.0.6"
,
"awesome-typescript-loader"
:
"^5.2.0"
,
"chai"
:
"^4.2.0"
,
"copy-webpack-plugin"
:
"^4.5.2"
,
"mocha"
:
"^5.2.0"
,
"source-map-loader"
:
"^0.2.3"
,
...
...
extension/src/common/data.ts
View file @
f29feaac
...
...
@@ -334,7 +334,7 @@ export function getAcceptRdf(includeHTML: boolean): string {
})
.
reduce
((
acc
:
string
,
mime
:
MimeInfo
,
index
:
number
)
=>
{
if
(
acc
.
length
===
0
)
return
mime
.
mime
;
return
acc
+
"
,
"
+
mime
.
mime
+
"
;q=
"
+
(
1
-
0.1
*
index
).
toString
();
return
acc
+
"
,
"
+
mime
.
mime
+
"
;q=
"
+
(
1
-
0.1
*
index
).
toPrecision
(
2
).
toString
();
},
""
)
+
(
includeHTML
?
"
, text/html;q=0.1
"
:
""
)
);
}
...
...
@@ -1052,18 +1052,7 @@ export function checkCompliance(data: ResourceData): ComplianceWarning[] {
export
function
tryNegotiateData
(
target
:
string
):
Promise
<
DocumentSourceLinked
>
{
let
accept
=
Object
.
keys
(
MIME
)
.
map
(
key
=>
{
return
MIME
[
key
];
})
.
sort
((
x
:
MimeInfo
,
y
:
MimeInfo
)
=>
{
return
x
.
priority
-
y
.
priority
;
})
.
reduce
((
acc
:
string
,
mime
:
MimeInfo
,
index
:
number
)
=>
{
if
(
acc
.
length
===
0
)
return
mime
.
mime
;
return
acc
+
"
,
"
+
mime
.
mime
+
"
;q=
"
+
(
1
-
0.1
*
index
).
toString
();
},
""
);
let
accept
=
getAcceptRdf
(
false
);
return
new
Promise
(
function
(
resolve
,
reject
)
{
let
xmlHttp
=
new
XMLHttpRequest
();
xmlHttp
.
onreadystatechange
=
function
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment