5G-MAG / rt-5gms-application-server

5G Media Streaming - Application Server
https://www.5g-mag.com/streaming
Other
4 stars 5 forks source link

Incorrect error response status code for M1_ContentHostingProvisioning_purgeContentHostingCache operation #52

Closed devbbc closed 1 year ago

devbbc commented 1 year ago

Description

If the purge regex pattern is invalid, the Application Server raises an exception and produces a local error log. However, the Application Server returns a response with status code 200 (OK) to the invoking client.

I think the response should have status code 422 (Unprocessable Entity) indicating that there is something wrong with the request message body.

Additional context

This bug arises from 5G-MAG/rt-5gms-application-function#18.

rjb1000 commented 1 year ago

I have created a Pull Request 5G-MAG/rt-common-shared#16 to add 422 (Unprocessable Entity) to the M3 API as a response to the purgeContentHostingCache operation.

rjb1000 commented 1 year ago

I have also raised 5G-MAG/Standards#40 to add this error response code (as well as a few others) to the purgeContentHostingCache operation in the M1 RESTful API specified in 3GPP TS 26.512.

rjb1000 commented 1 year ago

The ProblemDetails JSON structure conveyed as the body of the HTTP error response should clearly distinguish the various error cases:

  1. The request message body does not conform to the required x-www-form-urlencoded syntax.
  2. The form supplied in the request message body is syntactically correct, but does not include the required key.
  3. The form supplied in the request message body is syntactically correct, but includes unrecognised additional keys.
    • (Less important for the Application Server to check? Maybe it could simply ignore additional keys in the supplied form?)
  4. The form supplied in the request message body is syntactically correct, but the supplied regular expression does not conform to the required syntax.
    • e.g. the regular expression parser threw an error when attempting to compile it.