Skip to content

Commit

Permalink
Few tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Sija committed May 7, 2024
1 parent fb05364 commit 69c918a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ REST web API for the [libgphoto2](http://www.gphoto.org/) library. You can use i

| name | value | description |
| ---------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `download` | `true` | Make the browser download the image instead of displaying it |
| `download` | `true` | Makes the browser download the image instead of displaying it |
| `format` | `jpeg` / `webp` / `avif` / `png` / `auto` | Returns the image in a given format, `auto` chooses between `avif`, `webp` and `jpeg` (in that order), depending on the browser support |
| `width` | *integer* | Returns the image scaled down to the given width |
| `height` | *integer* | Returns the image scaled down to the given height |
Expand Down
7 changes: 2 additions & 5 deletions src/ext/kemal.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ def restore_headers_on_exception(response, &)
begin
yield response
rescue ex
diff_keys = response.headers.keys - prev_headers.keys
diff_keys.each do |key|
response.headers.delete(key)
end
response.headers.clear
prev_headers.each do |key, value|
response.headers[key] = value
end
Expand Down Expand Up @@ -36,7 +33,7 @@ def request_accepts?(request, content_type)
accepts = request.headers["Accept"]?.try do |value|
value
.split(',')
.map(&.strip.sub(/;.*$/, ""))
.map!(&.strip.sub(/;.*$/, ""))
end
!!accepts.try &.includes?(content_type)
end
Expand Down

0 comments on commit 69c918a

Please sign in to comment.