Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wing #24

Merged
merged 4 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/api-basic-auth-middleware/basic-auth.w
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
bring cloud;

class Utils {
pub class Utils {
extern "./utils.js" pub static inflight base64decode(value: str): str;
extern "./utils.js" pub static inflight base64encode(value: str): str;
init() { }
}

struct Credentials {
pub struct Credentials {
username: str;
password: str;
}

class BasicAuth {
pub class BasicAuth {
user: str;
password: str;

Expand Down Expand Up @@ -47,8 +47,8 @@ class BasicAuth {
// workaround for https://github.com/winglang/wing/issues/3205
inflight authHeader(headers: Map<str>?): str {
if (this.authHeaderPresent(headers)) {
let authHeaderOptional = headers?.get("authorization");
let var authHeader = headers?.get("Authorization");
let authHeaderOptional = headers?.tryGet("authorization");
let var authHeader = headers?.tryGet("Authorization");

if (authHeader == nil) {
authHeader = authHeaderOptional;
Expand Down
8 changes: 4 additions & 4 deletions examples/api-basic-auth/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class BasicAuth {
let username = credentials.username;
let password = credentials.password;
return username == this.user && password == this.password;
} catch {
log("exception caught - no auth header");
} catch e {
log("exception caught ${e}");
return false;
}
}
Expand All @@ -49,8 +49,8 @@ class BasicAuth {
// workaround for https://github.com/winglang/wing/issues/3205
inflight authHeader(headers: Map<str>?): str {
if (this.authHeaderPresent(headers)) {
let authHeaderOptional = headers?.get("authorization");
let var authHeader = headers?.get("Authorization");
let authHeaderOptional = headers?.tryGet("authorization");
let var authHeader = headers?.tryGet("Authorization");

if (authHeader == nil) {
authHeader = authHeaderOptional;
Expand Down
2 changes: 1 addition & 1 deletion examples/todo-app/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ let taskApi = new TaskService(storage);
test "list tasks" {
storage.add("task 1");
let url = taskApi.api.url;
let response = http.get("${url}/tasks");
let response = http.get("${url}/tasks?search=task");
log("response: ${Json.stringify(response.body)}");
assert(response.status == 200);
assert(response.body == Json.stringify(Json[{"id":"0","description":"task 1","status":"PENDING"}]));
Expand Down
Empty file added examples/todo-app/skip.ci.aws
Empty file.
Loading