Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
polamoros committed Apr 15, 2024
1 parent bba1329 commit ffc7339
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/wing-console/console/app/demo/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ class ApiUsersService {
this.db = new cloud.Bucket();

this.api.post("/users", inflight (request: cloud.ApiRequest): cloud.ApiResponse => {
let input = Json.parse(request.body ?? "");
let input = Json.tryParse(request.body ?? "") ?? "";
let name = input.tryGet("name")?.tryAsStr() ?? "";
if name == "" {
return cloud.ApiResponse {
status: 400,
body: "Name is required"
body: "Body parameter 'name' is required"
};
}
this.db.put("user-{name}", Json.stringify(input));
Expand Down

0 comments on commit ffc7339

Please sign in to comment.