Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong "max one service-path allowed for subscriptions" in NGSIv2 subscription operation #2948

Closed
fgalan opened this issue Jun 26, 2017 · 3 comments · Fixed by #3034
Closed

Comments

@fgalan
Copy link
Member

fgalan commented Jun 26, 2017

Attemping to subscribe using POST /v2/subscriptions with multiple service paths, the following error message is returned:

< HTTP/1.1 200 OK
< Connection: Keep-Alive
< Content-Length: 184
< Content-Type: application/json
< Fiware-Correlator: 3fab418c-5a4f-11e7-9af0-000c29173617
< Date: Mon, 26 Jun 2017 09:10:07 GMT
< 
{
  "subscribeError" : {
    "errorCode" : {
      "code" : "400",
      "reasonPhrase" : "Bad Request",
      "details" : "max one service-path allowed for subscriptions"
    }
  }
}

The semantics of the error are ok. However, the syntax is not correct for a NGSIv2 message:

  1. Payload should be based on error and description.
  2. Response code should be 400 and not 200.
@fgalan fgalan added the bug label Jun 26, 2017
@kzangeli
Copy link
Member

My guess is that this error is detected before we detect that it is a APIv2 request.
The fix should be to simply delay the check of multiple service path until after the detection of API v1/v2.

@arigliano
Copy link
Contributor

arigliano commented Oct 31, 2017

As I can see, both postSubscriptions (V2) and postSubscribeContext methods fill the SubscribeError struct. This provides only a render() method, printing out in both cases the same V1 response. Then a toJson() method that prints out V2 messages, should be implemented. Furthermore, an approach similar to OrionError struct and its smartRender(), could be followed.

arigliano added a commit to arigliano/fiware-orion that referenced this issue Oct 31, 2017
Implemented toJson() method in SubscribeContextResponse, SubscribeError
and SubscriptionId
arigliano added a commit to arigliano/fiware-orion that referenced this issue Nov 6, 2017
- Fixed HttpStatusCode of the response
- New test for the fixed issue added
- New entry in CHANGES_NEXT_RELEASE added
@fgalan
Copy link
Member Author

fgalan commented Nov 6, 2017

Fixed by PR #3034

@fgalan fgalan added this to the 1.10.0 milestone Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants