fix(imageopto): correct contrast URL parameter spelling#260
Merged
Conversation
The Contrast option in imageopto.go:884 was building URLs with `constrast=<value>`, but Fastly's Image Optimizer expects the parameter to be spelled `contrast` (per https://www.fastly.com/documentation/reference/io/contrast/). The typo meant any user setting `Options{Contrast: ...}` was silently sending an unknown query parameter that Image Optimizer ignored, so the SDK option has effectively been a no-op since it was introduced. Rename the URL parameter to the correct `contrast` spelling in both the builder (imageopto.go) and the testdata fixture (imageopto_test.go). The existing test now asserts the correct URL, so `go test ./fsthttp/imageopto/...` exercises the corrected behavior. Fixes fastly#258 Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Contributor
Author
|
Thanks @dgryski for landing the contrast URL parameter spelling fix; constrast had been building the wrong query strings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #258. The
Contrastoption infsthttp/imageopto/imageopto.go:884was building URLs withconstrast=<value>instead ofcontrast=<value>. Per Fastly's Image Optimizer reference (https://www.fastly.com/documentation/reference/io/contrast/), the parameter is spelledcontrast. The typo meant any user settingOptions{Contrast: ...}was silently sending an unknown query parameter that Image Optimizer ignored, so the SDK option has effectively been a no-op since it was introduced.Why this matters
The reporter noticed it via inspection on line 884. I confirmed against the official IO reference - the canonical parameter name is
contrast, notconstrast. The existing test onimageopto_test.go:19was locked to the typo'd output, so the test passing didn't catch that the actual contrast adjustment never reached IO at runtime. Fixing the typo activates the feature that was already documented as supported.Changes
fsthttp/imageopto/imageopto.go:884-constrast=->contrast=fsthttp/imageopto/imageopto_test.go:19- matching expected-URL fixture updated tocontrast=-5No public Go API change (
Options.Contrastfield name is unchanged). The behavior change is that the parameter now actually reaches the IO service.How to test
Fixes #258
AI-assisted.