Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 [Bug]: EnvVar middleware parsing error #2068

Closed
3 tasks done
fufuok opened this issue Aug 31, 2022 · 2 comments 路 Fixed by #2069
Closed
3 tasks done

馃悰 [Bug]: EnvVar middleware parsing error #2068

fufuok opened this issue Aug 31, 2022 · 2 comments 路 Fixed by #2069

Comments

@fufuok
Copy link
Contributor

fufuok commented Aug 31, 2022

Bug Description

func TestEnvVarHandlerSpecialValue(t *testing.T) {
	os.Setenv("testEnvKey", "testBase64:TQ==")
	defer os.Unsetenv("testEnvKey")

	app := fiber.New()
	app.Use("/envvars", New())

	req, _ := http.NewRequest("GET", "http://localhost/envvars", nil)
	resp, err := app.Test(req)
	utils.AssertEqual(t, nil, err)

	respBody, err := ioutil.ReadAll(resp.Body)
	utils.AssertEqual(t, nil, err)

	var envVars EnvVar
	utils.AssertEqual(t, nil, json.Unmarshal(respBody, &envVars))
	val := envVars.Vars["testEnvKey"]
	utils.AssertEqual(t, "testBase64:TQ==", val)
}
=== RUN   TestEnvVarHandlerSpecialValue
    envvar_test.go:124: 
        Test:       TestEnvVarHandlerSpecialValue
        Trace:      envvar_test.go:124
        Expect:     testBase64:TQ==     (string)
        Result:     testBase64:TQ       (string)
--- FAIL: TestEnvVarHandlerSpecialValue (0.00s)

FAIL

How to Reproduce

Run the above test case.

Expected Behavior

PASS

Fiber Version

v2.37.0

Code Snippet (optional)

No response

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.
@fufuok
Copy link
Contributor Author

fufuok commented Aug 31, 2022

After:

=== RUN   TestEnvVarHandlerSpecialValue
--- PASS: TestEnvVarHandlerSpecialValue (0.00s)
PASS

@mstrYoda
Copy link
Member

mstrYoda commented Sep 3, 2022

Thank you, I was about to send a commit for multiple "=" characters and just wanted to check issues before and saw your PR 馃憤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants