-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
tests/core/snapshots/test-js-multi-onRequest-handlers.md_0.snap
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,16 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: response | ||
--- | ||
{ | ||
"status": 200, | ||
"headers": { | ||
"content-type": "application/json" | ||
}, | ||
"body": { | ||
"data": { | ||
"foo": "its intercepted foo", | ||
"bar": "its intercepted bar" | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/core/snapshots/test-js-multi-onRequest-handlers.md_client.snap
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,24 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: client | ||
--- | ||
scalar Date | ||
|
||
scalar Email | ||
|
||
scalar Empty | ||
|
||
scalar JSON | ||
|
||
scalar PhoneNumber | ||
|
||
type Query { | ||
bar: String | ||
foo: String | ||
} | ||
|
||
scalar Url | ||
|
||
schema { | ||
query: Query | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/core/snapshots/test-js-multi-onRequest-handlers.md_merged.snap
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,12 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: merged | ||
--- | ||
schema @server @upstream(onRequest: "foo", baseURL: "http://localhost:3000") @link(src: "test1.js", type: Script) { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
bar: String @http(onRequest: "bar", baseURL: "http://localhost:3000", path: "/bar") | ||
foo: String @http(baseURL: "http://localhost:3000", path: "/foo") | ||
} |
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,47 @@ | ||
# Js Request - Multiple onRequest Handlers | ||
|
||
```js @file:test1.js | ||
function onRequest({request}) { | ||
return {request} | ||
} | ||
function foo({request}) { | ||
return { | ||
response: { | ||
status: 200, | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify("its intercepted foo"), | ||
}, | ||
} | ||
} | ||
function bar({request}) { | ||
return { | ||
response: { | ||
status: 200, | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify("its intercepted bar"), | ||
}, | ||
} | ||
} | ||
``` | ||
|
||
```graphql @config | ||
schema @server @upstream(baseURL: "http://localhost:3000", onRequest: "foo") @link(type: Script, src: "test1.js") { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
foo: String @http(baseURL: "http://localhost:3000", path: "/foo") | ||
bar: String @http(baseURL: "http://localhost:3000", path: "/bar", onRequest: "bar") | ||
} | ||
``` | ||
|
||
```yml @test | ||
- method: POST | ||
url: http://localhost:8080/graphql | ||
body: | ||
query: query { foo bar } | ||
``` |
fb195f5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running 30s test @ http://localhost:8000/graphql
4 threads and 100 connections
437819 requests in 30.01s, 2.19GB read
Requests/sec: 14588.18
Transfer/sec: 74.88MB