TritonDataCenter / sdc-docker

Docker Engine for Triton
Mozilla Public License 2.0
183 stars 49 forks source link

DOCKER-460: docker build should error out earlier if possible #45

Closed misterdjules closed 9 years ago

misterdjules commented 9 years ago

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

orlandov commented 9 years ago

LGTM

misterdjules commented 9 years ago

@trentm Updated this PR according to our discussion during a previous code review.

trentm commented 9 years ago

Discussed offline. LGTM.

misterdjules commented 9 years ago

Merged with 4b869e24cb5c850e43cdf9f025d145abf1fe8c5d, thank you @trentm and @orlandov :+1: