glide icon indicating copy to clipboard operation
glide copied to clipboard

Add 400 Bad Request when using bad value or unknown parameters with Server::getImageResponse

Open B-Galati opened this issue 6 years ago • 2 comments

Hello,

What about validating provided parameters and answer a 400 Bad Response http code when.

For example when calling:

$server->getImageResponse($path, ['unvalid' => 'value']);

It would return a http response with 400 status code which explain what is wrong.

I do think it would improve DX and UX.

What do you think?

B-Galati avatar Aug 21 '18 17:08 B-Galati

I think 400 responses make sense when expected parameters are incorrect, e.g. ?w=johnny. I'm hesitant to 400 with unsupported values: w=100&h=100&tracker=15123. There are too many options for what applications may be adding for their own purposes.

I would be interested if it's something you could turn on and off, on in production off in development to catch potential issues.

baileylo avatar Aug 21 '18 21:08 baileylo

I do agree for unknown parameters :+1:

Turning on and off could be a bad idea in the sense of it could hide some unwanted mistakes.

B-Galati avatar Aug 23 '18 06:08 B-Galati