Skip to content

Commit

Permalink
Merge pull request #954 from opencb/TASK-6431
Browse files Browse the repository at this point in the history
TASK-6431 - IVA performs queries to OpenCGA adding the token as a query param instead of using the Authorization header
  • Loading branch information
jmjuanes authored Aug 7, 2024
2 parents 85c79a0 + 741d204 commit f922012
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/webcomponents/api/opencga-rest-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ export default class OpencgaRestInput extends LitElement {
url = url.replace("{apiVersion}", this.opencgaSession.opencgaClient._config.version);

if (this.endpoint.method === "GET" || this.endpoint.method === "DELETE") {
url += "sid=" + this.opencgaSession.opencgaClient._config.token;
this.#getOrDeleteEndpoint(url);
}

Expand All @@ -388,8 +387,12 @@ export default class OpencgaRestInput extends LitElement {
});

let error, result;
const options = {
method: this.endpoint.method,
token: this.opencgaSession.opencgaClient._config.token,
};
this.#setLoading(true);
this.restClient.call(url, {method: this.endpoint.method})
this.restClient.call(url, options)
.then(response => {
result = UtilsNew.objectClone(response.responses[0].results);
})
Expand Down Expand Up @@ -431,7 +434,7 @@ export default class OpencgaRestInput extends LitElement {
const _options = {
sid: this.opencgaSession.opencgaClient._config.token,
token: this.opencgaSession.opencgaClient._config.token,
data: isForm ? this.formatBody(this.data?.body) : JSON.parse(this.dataJson?.body),
data: isForm ? this.formatBody(this.data?.body) : JSON.parse(this.dataJson?.body || "{}"),
method: "POST",
};

Expand Down

0 comments on commit f922012

Please sign in to comment.