-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from nomeata/joachim/http-gateway
- Loading branch information
Showing
4 changed files
with
186 additions
and
5 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
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
type HeaderField = record { text; text; }; | ||
|
||
type HttpRequest = record { | ||
method: text; | ||
url: text; | ||
headers: vec HeaderField; | ||
body: blob; | ||
}; | ||
|
||
type HttpResponse = record { | ||
status_code: nat16; | ||
headers: vec HeaderField; | ||
body: blob; | ||
upgrade : opt bool; | ||
streaming_strategy: opt StreamingStrategy; | ||
}; | ||
|
||
// Each canister that uses the streaming feature gets to choose their concrete | ||
// type; the HTTP Gateway will treat it as an opaque value that is only fed to | ||
// the callback method | ||
|
||
type StreamingToken = /* application-specific type */ | ||
|
||
|
||
type StreamingCallbackHttpResponse = record { | ||
body: blob; | ||
token: opt StreamingToken; | ||
}; | ||
|
||
type StreamingStrategy = variant { | ||
Callback: record { | ||
callback: func (StreamingToken) -> (opt StreamingCallbackHttpResponse) query; | ||
token: StreamingToken; | ||
}; | ||
}; | ||
|
||
service : { | ||
http_request: (request: HttpRequest) -> (HttpResponse) query; | ||
http_request_update: (request: HttpRequest) -> (HttpResponse); | ||
} | ||
|
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