Skip to content

Commit

Permalink
Merge pull request #386 from danielpeintner/issue-385
Browse files Browse the repository at this point in the history
create shallow copy of form for uriVariables and update href
  • Loading branch information
danielpeintner authored Feb 18, 2021
2 parents 963a753 + 889232a commit 1382cd1
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/core/src/consumed-thing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,13 +494,9 @@ export default class ConsumedThing extends TD.Thing implements WoT.ConsumedThing
let ut = UriTemplate.parse(form.href);
let updatedHref = ut.expand(options == undefined || options.uriVariables == undefined ? {} : options.uriVariables);
if (updatedHref != form.href) {
// "clone" form to avoid modifying original form
let updForm = new TD.Form(updatedHref, form.contentType);
updForm.op = form.op;
updForm.security = form.security;
updForm.scopes = form.scopes;
updForm.response = form.response;

// create shallow copy and update href
let updForm = { ...form };
updForm.href = updatedHref;
form = updForm;
console.debug("[core/consumed-thing]",`ConsumedThing '${this.title}' update form URI to ${form.href}`);
}
Expand Down

0 comments on commit 1382cd1

Please sign in to comment.