Skip to content

Commit

Permalink
fixup! chore(binding-http): enable eslint/strict-boolean-expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Sep 30, 2023
1 parent d6db9a3 commit f215aa4
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions packages/binding-http/src/http-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,10 @@ export default class HttpServer implements ProtocolServer {
}
}

for (const actionName in thing.actions) {
for (const [actionName, action] of Object.entries(thing.actions)) {
const actionNamePattern = Helpers.updateInteractionNameWithUriVariablePattern(
actionName,
thing.actions[actionName].uriVariables,
action.uriVariables,
thing.uriVariables
);
const href = base + "/" + this.ACTION_DIR + "/" + actionNamePattern;
Expand All @@ -432,18 +432,17 @@ export default class HttpServer implements ProtocolServer {
);
form.op = ["invokeaction"];
const hform: HttpForm = form;
if (hform["htv:methodName"] === undefined) {
hform["htv:methodName"] = "POST";
}
thing.actions[actionName].forms.push(form);

hform["htv:methodName"] ??= "POST";
action.forms.push(form);
debug(`HttpServer on port ${this.getPort()} assigns '${href}' to Action '${actionName}'`);
this.addUrlRewriteEndpoints(form, thing.actions[actionName].forms);
this.addUrlRewriteEndpoints(form, action.forms);
}

for (const eventName in thing.events) {
for (const [eventName, event] of Object.entries(thing.events)) {
const eventNamePattern = Helpers.updateInteractionNameWithUriVariablePattern(
eventName,
thing.events[eventName].uriVariables,
event.uriVariables,
thing.uriVariables
);
const href = base + "/" + this.EVENT_DIR + "/" + eventNamePattern;
Expand All @@ -454,9 +453,9 @@ export default class HttpServer implements ProtocolServer {
);
form.subprotocol = "longpoll";
form.op = ["subscribeevent", "unsubscribeevent"];
thing.events[eventName].forms.push(form);
event.forms.push(form);
debug(`HttpServer on port ${this.getPort()} assigns '${href}' to Event '${eventName}'`);
this.addUrlRewriteEndpoints(form, thing.events[eventName].forms);
this.addUrlRewriteEndpoints(form, event.forms);
}
}
}
Expand Down

0 comments on commit f215aa4

Please sign in to comment.