Skip to content

Commit

Permalink
Fixed #3435 RestHandler losing exception info when response was consi…
Browse files Browse the repository at this point in the history
…dered invalid by schema validator
  • Loading branch information
Ondřej Musil committed Jun 26, 2019
1 parent ca28e1f commit d618554
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doxygen/lang/900_release_notes.dox.tmpl
Expand Up @@ -50,6 +50,8 @@
- fixed the timeout value for upgrading the SSL connection in \c Pop3Client
(<a href="https://github.com/qorelanguage/qore/issues/3388">issue 3388</a>)
- <a href="../../modules/RestHandler/html/index.html">RestHandler</a> module:
- fixed RestHandler losing internal exception info when response was considered invalid by schema validator
(<a href="https://github.com/qorelanguage/qore/issues/3435">issue 3435</a>)
- fixed RestHandler incorrectly handling Accept header of incoming requests
(<a href="https://github.com/qorelanguage/qore/issues/3426">issue 3426</a>)
- added debug logging for REST schema validation errors
Expand Down
9 changes: 8 additions & 1 deletion qlib/RestHandler.qm
Expand Up @@ -347,6 +347,8 @@ Content-Length: 16
@section resthandler_relnotes RestHandler Release Notes

@subsection rh_1_3_1 RestHandler v1.3.1
- fixed RestHandler losing internal exception info when response was considered invalid by schema validator
(<a href="https://github.com/qorelanguage/qore/issues/3435">issue 3435</a>)
- fixed RestHandler incorrectly handling Accept header of incoming requests
(<a href="https://github.com/qorelanguage/qore/issues/3426">issue 3426</a>)
- added debug loggging for REST schema validation errors
Expand Down Expand Up @@ -1325,7 +1327,12 @@ public namespace RestHandler {
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html: If an Accept header field is present, and if the server cannot send a response which is acceptable according to the combined Accept field value, then the server SHOULD send a 406 (not acceptable) response.
return AbstractHttpRequestHandler::makeResponse(406, ex.desc);
}
rethrow;

# add original resp to the exception (only if it was an error)
if (rv.code >= 400 && rv.code < 600)
ex.desc += sprintf(" ... Original response: code: %d, body: %y, hdr: %y", rv.code, rv.body, rv.hdr);

throw ex.err, ex.desc, ex.arg;
}

rv += (
Expand Down

0 comments on commit d618554

Please sign in to comment.