Add headers parameter for URL STL load
This commit is contained in:
parent
c67d641e43
commit
f0c85a0585
2 changed files with 5 additions and 4 deletions
|
|
@ -328,7 +328,7 @@ function platformLoad(url, onload) {
|
|||
}
|
||||
}
|
||||
|
||||
function platformLoadSTL(url, onload, formdata, credentials) {
|
||||
function platformLoadSTL(url, onload, formdata, credentials, headers) {
|
||||
new load.STL().load(url, (vertices, filename) => {
|
||||
if (vertices) {
|
||||
let widget = newWidget().loadVertices(vertices);
|
||||
|
|
@ -338,7 +338,7 @@ function platformLoadSTL(url, onload, formdata, credentials) {
|
|||
onload(vertices, widget);
|
||||
}
|
||||
}
|
||||
}, formdata, 1 / api.view.unit_scale(), credentials);
|
||||
}, formdata, 1 / api.view.unit_scale(), credentials, headers);
|
||||
}
|
||||
|
||||
function platformLoadURL(url, options = {}) {
|
||||
|
|
|
|||
|
|
@ -23,13 +23,14 @@ function STL() {
|
|||
this.colors = null;
|
||||
}
|
||||
|
||||
SP.load = function(url, callback, formdata, scale, credentials) {
|
||||
SP.load = function(url, callback, formdata, scale, credentials, headers) {
|
||||
const stl = this;
|
||||
|
||||
fetch(url, {
|
||||
method: formdata ? 'POST' : 'GET',
|
||||
credentials: credentials ? credentials : 'same-origin',
|
||||
body: formdata
|
||||
body: formdata,
|
||||
...(headers ? {headers: headers} : {})
|
||||
}).then(response => {
|
||||
if (response.status === 200 || response.status === 0) {
|
||||
response.arrayBuffer().then(buffer => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue