NOISSUE - Update the /disconnect endpoint HTTP method as PUT (#1438)

* NOISSUE - Update the /disconnect endpoint HTTP method as POST

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Update disconnection request name in spec

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

Update description

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Replaced POST with PUT

Signed-off-by: Burak Sekili <buraksekili@gmail.com>
This commit is contained in:
Burak Sekili 2021-07-13 14:31:20 +03:00 committed by GitHub
parent 2cfff01979
commit 19f0437f57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 2 deletions

View File

@ -375,6 +375,31 @@ paths:
description: Missing or invalid content type.
'500':
$ref: "#/components/responses/ServiceError"
/disconnect:
put:
summary: Disconnect things and channels using lists of IDs.
description: |
Disconnect things from channels specified by lists of IDs.
Channels and things are owned by user identified using the provided access token.
tags:
- things
parameters:
- $ref: "#/components/parameters/Authorization"
requestBody:
$ref: "#/components/requestBodies/DisconnReq"
responses:
'200':
$ref: "#/components/responses/DisconnRes"
'400':
description: Failed due to malformed JSON.
'401':
description: Missing or invalid access token provided.
'404':
description: A non-existent entity request.
'415':
description: Missing or invalid content type.
'500':
$ref: "#/components/responses/ServiceError"
/things/{thingId}/channels:
get:
summary: List of channels connected to specified thing
@ -912,6 +937,13 @@ components:
application/json:
schema:
$ref: "#/components/schemas/ConnectionReqSchema"
DisconnReq:
description: JSON-formatted document describing the entities for disconnection.
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ConnectionReqSchema"
IdentityReq:
description: JSON-formatted document that contains thing key.
required: true
@ -993,6 +1025,8 @@ components:
type: string
description: Created thing's relative URL.
example: /things/{thingId}
DisconnRes:
description: Things disconnected.
AccessGrantedRes:
description: |
Thing has access to the specified channel and the thing ID is returned.

View File

@ -2587,7 +2587,7 @@ func TestDisconnectList(t *testing.T) {
req := testRequest{
client: ts.Client(),
method: http.MethodDelete,
method: http.MethodPut,
url: fmt.Sprintf("%s/disconnect", ts.URL),
contentType: tc.contentType,
token: tc.auth,

View File

@ -162,7 +162,7 @@ func MakeHandler(tracer opentracing.Tracer, svc things.Service) http.Handler {
opts...,
))
r.Delete("/disconnect", kithttp.NewServer(
r.Put("/disconnect", kithttp.NewServer(
kitot.TraceServer(tracer, "disconnect")(disconnectEndpoint(svc)),
decodeConnectList,
encodeResponse,