forked from apache/dubbo-go-pixiu
-
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.
Merge pull request apache#1 from dubbogo/develop
- Loading branch information
Showing
114 changed files
with
5,440 additions
and
879 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 |
---|---|---|
@@ -1,43 +1,38 @@ | ||
name: api name | ||
description: api description | ||
name: proxy | ||
description: proxy sample | ||
resources: | ||
- path: '/' | ||
- path: '/api/v1/test-dubbo/user' | ||
type: restful | ||
description: resource documentation | ||
filters: | ||
- filter0 | ||
description: user | ||
methods: | ||
- httpVerb: GET | ||
onAir: true | ||
timeout: 1000ms | ||
inboundRequest: | ||
requestType: http | ||
queryStrings: | ||
- name: id | ||
required: false | ||
- name: name | ||
required: true | ||
integrationRequest: | ||
requestType: dubbo | ||
requestType: http | ||
host: 127.0.0.1:8889 | ||
path: /UserProvider/GetUserByName | ||
mappingParams: | ||
- name: queryStrings.id | ||
mapTo: 1 | ||
applicationName: "BDTService" | ||
interface: "com.ikurento.user.UserProvider" | ||
method: "GetUser" | ||
clusterName: "test_dubbo" | ||
|
||
definitions: | ||
- name: modelDefinition | ||
schema: >- | ||
{ | ||
"type" : "object", | ||
"properties" : { | ||
"id" : { | ||
"type" : "integer" | ||
}, | ||
"type" : { | ||
"type" : "string" | ||
}, | ||
"price" : { | ||
"type" : "number" | ||
} | ||
} | ||
} | ||
- name: queryStrings.name | ||
mapTo: queryStrings.name | ||
group: "test" | ||
version: 1.0.0 | ||
- httpVerb: POST | ||
onAir: true | ||
timeout: 1000ms | ||
inboundRequest: | ||
requestType: http | ||
queryStrings: | ||
- name: name | ||
required: true | ||
integrationRequest: | ||
requestType: http | ||
host: 127.0.0.1:8889 | ||
path: /UserProvider/CreateUser | ||
group: "test" | ||
version: 1.0.0 |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Samples | ||
|
||
|
||
[中文](./zh-cn/README.md) | ||
* [dubbo](dubbo.md) | ||
* [http](http.md) | ||
* [mock](mock.md) |
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,59 @@ | ||
# Get the parameter from the body | ||
|
||
> POST request | ||
## Passthroughs | ||
|
||
### Api Config | ||
|
||
```yaml | ||
name: proxy | ||
description: proxy sample | ||
resources: | ||
- path: '/api/v1/test-dubbo/user' | ||
type: restful | ||
description: user | ||
methods: | ||
- httpVerb: POST | ||
onAir: true | ||
timeout: 1000ms | ||
inboundRequest: | ||
requestType: http | ||
queryStrings: | ||
- name: name | ||
required: true | ||
integrationRequest: | ||
requestType: http | ||
host: 127.0.0.1:8889 | ||
path: /UserProvider/CreateUser | ||
group: "test" | ||
version: 1.0.0 | ||
``` | ||
### Request | ||
```bash | ||
curl host:port/api/v1/test-dubbo/user -X POST -d '{"name": "tiecheng","id": "0002","code": 3,"age": 18}' --header "Content-Type: application/json" | ||
``` | ||
### Response | ||
- If first add, return like: | ||
```json | ||
{ | ||
"id": "0002", | ||
"code": 3, | ||
"name": "tiecheng", | ||
"age": 18, | ||
"time": "0001-01-01T00:00:00Z" | ||
} | ||
``` | ||
|
||
- If you add user multi, return like: | ||
|
||
```json | ||
{ | ||
"message": "data is exist" | ||
} | ||
``` |
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,128 @@ | ||
# Get the parameter from the body | ||
|
||
> POST request [samples](https://github.com/dubbogo/dubbo-go-proxy/tree/develop/samples/dubbogo/simple/body) | ||
## Passthroughs | ||
|
||
### Api Config | ||
|
||
```yaml | ||
name: proxy | ||
description: proxy sample | ||
resources: | ||
- path: '/api/v1/test-dubbo/user' | ||
type: restful | ||
description: user | ||
methods: | ||
- httpVerb: POST | ||
onAir: true | ||
timeout: 10s | ||
inboundRequest: | ||
requestType: http | ||
integrationRequest: | ||
requestType: dubbo | ||
mappingParams: | ||
- name: requestBody._all | ||
mapTo: 0 | ||
applicationName: "UserProvider" | ||
interface: "com.dubbogo.proxy.UserService" | ||
method: "CreateUser" | ||
paramTypes: [ "object" ] | ||
group: "test" | ||
version: 1.0.0 | ||
clusterName: "test_dubbo" | ||
- httpVerb: PUT | ||
onAir: true | ||
timeout: 10s | ||
inboundRequest: | ||
requestType: http | ||
integrationRequest: | ||
requestType: dubbo | ||
mappingParams: | ||
- name: requestBody._all | ||
mapTo: 0 | ||
applicationName: "UserProvider" | ||
interface: "com.dubbogo.proxy.UserService" | ||
method: "UpdateUser" | ||
paramTypes: [ "object" ] | ||
group: "test" | ||
version: 1.0.0 | ||
clusterName: "test_dubbo" | ||
- path: '/api/v1/test-dubbo/user2' | ||
type: restful | ||
description: user | ||
methods: | ||
- httpVerb: PUT | ||
onAir: true | ||
timeout: 1000ms | ||
inboundRequest: | ||
requestType: http | ||
integrationRequest: | ||
requestType: dubbo | ||
mappingParams: | ||
- name: requestBody.name | ||
mapTo: 0 | ||
- name: requestBody.user | ||
mapTo: 1 | ||
applicationName: "UserService" | ||
interface: "com.dubbogo.proxy.UserService" | ||
method: "UpdateUserByName" | ||
paramTypes: [ "string", "object" ] | ||
group: "test" | ||
version: 1.0.0 | ||
clusterName: "test_dubbo" | ||
``` | ||
> when passthroughs, mapTo: 0 needed | ||
### Test | ||
- passthroughs | ||
```bash | ||
curl host:port/api/v1/test-dubbo/user -X POST -d '{"id":"0003","code":3,"name":"dubbogo","age":99}' --header "Content-Type: application/json" | ||
``` | ||
If first add, return like: | ||
```json | ||
{ | ||
"age": 99, | ||
"code": 3, | ||
"iD": "0003", | ||
"name": "dubbogo" | ||
} | ||
``` | ||
If you add user multi, return like: | ||
|
||
```json | ||
{ | ||
"message": "data is exist" | ||
} | ||
``` | ||
|
||
- update | ||
|
||
```bash | ||
curl host:port/api/v1/test-dubbo/user -X PUT -d '{"id":"0003","code":3,"name":"dubbogo","age":99}' --header "Content-Type: application/json" | ||
``` | ||
|
||
result | ||
|
||
```bash | ||
true | ||
``` | ||
|
||
- body parse multi params | ||
|
||
```bash | ||
curl host:port/api/v1/test-dubbo/user2 -X PUT -d '{"name":"tc","user":{"id":"0001","code":1,"name":"tc","age":99}}' --header "Content-Type: application/json" | ||
``` | ||
|
||
result | ||
|
||
```bash | ||
true | ||
``` | ||
|
||
[Previous](./dubbo.md) |
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.