Skip to content

Commit

Permalink
Merge pull request #30 from winglang/upgrade-winglang
Browse files Browse the repository at this point in the history
upgrade to recent winglang version
  • Loading branch information
skorfmann authored Nov 15, 2023
2 parents c554f9b + 1648533 commit 8601161
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 11 deletions.
3 changes: 1 addition & 2 deletions examples/api-basic-auth-middleware/basic-auth.w
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ bring cloud;
pub class Utils {
extern "./utils.js" pub static inflight base64decode(value: str): str;
extern "./utils.js" pub static inflight base64encode(value: str): str;
init() { }
}

pub struct Credentials {
Expand All @@ -15,7 +14,7 @@ pub class BasicAuth {
user: str;
password: str;

init(user: str?, password: str?) {
new(user: str?, password: str?) {
this.user = user ?? "admin";
this.password = password ?? "admin";
}
Expand Down
4 changes: 2 additions & 2 deletions examples/api-basic-auth/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BasicAuth {
user: str;
password: str;

init(user: str?, password: str?) {
new(user: str?, password: str?) {
this.user = user ?? "admin";
this.password = password ?? "admin";
}
Expand Down Expand Up @@ -111,6 +111,6 @@ test "authenticated" {
Authorization: "Basic " + util.base64Encode("admin:admin")
}
});

expect.equal(response.status, 200);
}
1 change: 0 additions & 1 deletion examples/api-counter-ssr/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class Utils {
// This is a workaround for the pending fs module
// https://github.com/winglang/wing/issues/3096
extern "./utils.js" pub static readFile(filePath: str): str;
init() { }
}

let templates = new cloud.Bucket();
Expand Down
1 change: 0 additions & 1 deletion examples/multiplayer-videogame/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ let website = new cloud.Website(path: "./front-end");
class Utils {
extern "./socket_utils.js" pub static inflight RunWebSocketServer(port:num);
extern "./socket_utils.js" pub static inflight CloseWebSocketServer(port:num);
init() { }
}

let lock = new cloud.Counter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ bring "aws-cdk-lib" as awscdk;
class CdkDockerImageFunction {
function: awscdk.aws_lambda.DockerImageFunction;

init() {
new() {
this.function = new awscdk.aws_lambda.DockerImageFunction({
code: awscdk.aws_lambda.DockerImageCode.fromImageAsset("./container"),
});
Expand Down
2 changes: 1 addition & 1 deletion examples/stock-poller/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let tickerSymbol = "GME";
class TwelveDataApi {
key: cloud.Secret;

init() {
new() {
this.key = new cloud.Secret(
name: "twelve-data-api-key"
);
Expand Down
6 changes: 3 additions & 3 deletions examples/todo-app/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TaskStorage impl ITaskStorage {
db: ex.Redis;
counter: cloud.Counter;

init() {
new() {
this.db = new ex.Redis();
this.counter = new cloud.Counter();
}
Expand Down Expand Up @@ -139,7 +139,7 @@ class TaskService {

extern "./tasklist_helper.js" static inflight createRegex(s: str): IRegExp;

init(storage: ITaskStorage) {
new(storage: ITaskStorage) {
this.api = new cloud.Api(cors: true);
this.taskStorage = storage;

Expand Down Expand Up @@ -247,6 +247,6 @@ test "list tasks" {
let response = http.get("${url}/tasks?search=task");
log("response: ${Json.stringify(response.body)}");
expect.equal(response.status, 200);
expect.equal(response.body, Json.stringify(Json[{"id":"0","description":"task 1","status":"PENDING"}]));
expect.equal(response.body, Json.stringify(Json[{"id":"0","description":"task 1","status":"PENDING"}]));
expect.equal(response.headers.get("access-control-allow-origin"), "*");
}

0 comments on commit 8601161

Please sign in to comment.