-
Notifications
You must be signed in to change notification settings - Fork 253
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
8 changed files
with
113 additions
and
7 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
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,55 @@ | ||
# Rest API | ||
|
||
#### file:operation-user.graphql | ||
|
||
```graphql | ||
query ($id: Int!) @rest(method: POST, path: "/user/$id") { | ||
user(id: $id) { | ||
id | ||
name | ||
} | ||
} | ||
``` | ||
|
||
#### server: | ||
|
||
```graphql | ||
schema | ||
@server | ||
@upstream(baseURL: "http://jsonplaceholder.typicode.com") | ||
@link(type: Operation, src: "operation-user.graphql") { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
user(id: Int!): User @http(path: "/users/{{args.id}}") | ||
} | ||
|
||
type User { | ||
id: Int! | ||
name: String! | ||
} | ||
``` | ||
|
||
#### mock: | ||
|
||
```yml | ||
- request: | ||
method: GET | ||
url: http://jsonplaceholder.typicode.com/users/1 | ||
headers: | ||
test: test | ||
body: null | ||
response: | ||
status: 200 | ||
body: | ||
id: 1 | ||
name: foo | ||
``` | ||
|
||
#### assert: | ||
|
||
```yml | ||
- method: POST | ||
url: http://localhost:8080/api/user/1 | ||
``` |
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
18 changes: 18 additions & 0 deletions
18
tests/snapshots/execution_spec__rest-api-post.md_assert_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,18 @@ | ||
--- | ||
source: tests/execution_spec.rs | ||
expression: response | ||
--- | ||
{ | ||
"status": 200, | ||
"headers": { | ||
"content-type": "application/json" | ||
}, | ||
"body": { | ||
"data": { | ||
"user": { | ||
"id": 1, | ||
"name": "foo" | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/snapshots/execution_spec__rest-api-post.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,16 @@ | ||
--- | ||
source: tests/execution_spec.rs | ||
expression: client | ||
--- | ||
type Query { | ||
user(id: Int!): User | ||
} | ||
|
||
type User { | ||
id: Int! | ||
name: String! | ||
} | ||
|
||
schema { | ||
query: Query | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/snapshots/execution_spec__rest-api-post.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,16 @@ | ||
--- | ||
source: tests/execution_spec.rs | ||
expression: merged | ||
--- | ||
schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") @link(src: "operation-user.graphql", type: Operation) { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
user(id: Int!): User @http(path: "/users/{{args.id}}") | ||
} | ||
|
||
type User { | ||
id: Int! | ||
name: String! | ||
} |
e9572ef
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
452350 requests in 30.01s, 2.27GB read
Requests/sec: 15075.09
Transfer/sec: 77.38MB