forked from PXshadow/weblink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING: split TCP and Web servers; make HTTP a distinct TCP handler
- Loading branch information
Showing
31 changed files
with
847 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ jobs: | |
run: npx haxe tests.hxml | ||
- name: run test | ||
run: hl test.hl | ||
timeout-minutes: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,19 +12,15 @@ class TestCredentialsProvider { | |
app.users(credentialsProvider); | ||
app.listen(2000, false); | ||
|
||
sys.thread.Thread.create(() -> { | ||
{ | ||
var response = Http.requestUrl("http://localhost:2000/users"); | ||
var testValue = '{"users":[{"username":"johndoe","email":"[email protected]","full_name":"John Doe","disabled":false}]}'; | ||
if (response != testValue) | ||
trace("/users: response data does not match: " + response + " data: " + testValue); | ||
|
||
app.close(); | ||
}); | ||
|
||
while (app.server.running) { | ||
app.server.update(false); | ||
Sys.sleep(0.2); | ||
} | ||
|
||
trace("done"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,11 @@ import weblink.security.OAuth; | |
class EndpointExample { | ||
var oAuth:OAuth; | ||
|
||
public function new(tokenUrl:String, secret_key:String, credentialsProvider:CredentialsProvider) { | ||
public function new( | ||
tokenUrl:String, | ||
secret_key:String, | ||
credentialsProvider:CredentialsProvider | ||
) { | ||
this.oAuth = new OAuth(tokenUrl, secret_key, credentialsProvider); | ||
} | ||
|
||
|
@@ -45,7 +49,7 @@ class TestEndpointExample { | |
var password = "secret"; | ||
var scope = ""; | ||
|
||
sys.thread.Thread.create(() -> { | ||
{ | ||
var http = new Http("http://localhost:2000/token"); | ||
http.setPostData('grant_type=${grant_type}&username=${username}&password=${password}&scope=${scope}'); | ||
http.request(false); | ||
|
@@ -63,21 +67,22 @@ class TestEndpointExample { | |
usersMeRequest.request(false); | ||
var testValueGet = '{"username":"johndoe","email":"[email protected]","full_name":"John Doe","disabled":false}'; | ||
if (usersMeRequest.responseData != testValueGet) | ||
throw "/users/me/: response data does not match: " + usersMeRequest.responseData + " data: " + testValueGet; | ||
throw "/users/me/: response data does not match: " | ||
+ usersMeRequest.responseData | ||
+ " data: " | ||
+ testValueGet; | ||
|
||
var usersMeItemsRequest = new Http("http://localhost:2000/users/me/items/"); | ||
usersMeItemsRequest.setHeader("Authorization", 'bearer ${data.access_token}'); | ||
usersMeItemsRequest.request(false); | ||
var testItemsGet = '[{"item_id":"Foo","owner":"johndoe"}]'; | ||
if (usersMeItemsRequest.responseData != testItemsGet) | ||
throw "/users/me/: response data does not match: " + usersMeItemsRequest.responseData + " data: " + testItemsGet; | ||
throw "/users/me/: response data does not match: " | ||
+ usersMeItemsRequest.responseData | ||
+ " data: " | ||
+ testItemsGet; | ||
|
||
app.close(); | ||
}); | ||
|
||
while (app.server.running) { | ||
app.server.update(false); | ||
Sys.sleep(0.2); | ||
} | ||
|
||
trace("done"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.