Separate implemented from unimplemented endpoints. Register
unimplemented ones before registering common handlers that imply
significant processing, such as (but not only) parsing requests' body.
For instance, this solve the problem when docker build would make the
server process the whole request's body before responding that the build
endpoint is not implemented.
This change also changes the behavior of the bodyParser handler so that
it errors if a request for an implemented handler passes through it.
This helps ensuring that further changes to the order in which handlers
are executed will still make unimplemented endpoints at least not go
through the body parser.
No regression in integration tests, and fixes the specific use case described in DOCKER-460.
Separate implemented from unimplemented endpoints. Register unimplemented ones before registering common handlers that imply significant processing, such as (but not only) parsing requests' body.
For instance, this solve the problem when docker build would make the server process the whole request's body before responding that the build endpoint is not implemented.
This change also changes the behavior of the bodyParser handler so that it errors if a request for an implemented handler passes through it. This helps ensuring that further changes to the order in which handlers are executed will still make unimplemented endpoints at least not go through the body parser.
No regression in integration tests, and fixes the specific use case described in DOCKER-460.
/cc @trentm @twhiteman @joshwilsdon