mirror of
https://github.com/openfaas/faas.git
synced 2025-06-08 16:26:47 +00:00
Add unit tests for new env variable
Signed-off-by: Matias Pan <matias.pan26@gmail.com>
This commit is contained in:
parent
9477970924
commit
0384832299
@ -228,7 +228,7 @@ func getAdditionalEnvs(config *WatchdogConfig, r *http.Request, method string) [
|
||||
}
|
||||
|
||||
envs = append(envs, fmt.Sprintf("Http_Method=%s", method))
|
||||
// DEPRECATED: Http_ContentLength will be deprecated in favour
|
||||
// Deprecation notice: Http_ContentLength will be deprecated
|
||||
envs = append(envs, fmt.Sprintf("Http_ContentLength=%d", r.ContentLength))
|
||||
envs = append(envs, fmt.Sprintf("Http_Content_Length=%d", r.ContentLength))
|
||||
|
||||
|
@ -55,6 +55,9 @@ func TestHandler_HasCustomHeaderInFunction_WithCgi_Mode(t *testing.T) {
|
||||
if !strings.Contains(val, "Http_ContentLength=0") {
|
||||
t.Errorf(config.faasProcess+" should print: Http_ContentLength=0, got: %s\n", val)
|
||||
}
|
||||
if !strings.Contains(val, "Http_Content_Length=0") {
|
||||
t.Errorf(config.faasProcess+" should print: Http_Content_Length=0, got: %s\n", val)
|
||||
}
|
||||
if !strings.Contains(val, "Http_Custom_Header") {
|
||||
t.Errorf(config.faasProcess+" should print: Http_Custom_Header, got: %s\n", val)
|
||||
}
|
||||
@ -94,6 +97,9 @@ func TestHandler_HasCustomHeaderInFunction_WithCgiMode_AndBody(t *testing.T) {
|
||||
if !strings.Contains(val, fmt.Sprintf("Http_ContentLength=%d", len(body))) {
|
||||
t.Errorf("'env' should printed: Http_ContentLength=0, got: %s\n", val)
|
||||
}
|
||||
if !strings.Contains(val, fmt.Sprintf("Http_Content_Length=%d", len(body))) {
|
||||
t.Errorf("'env' should printed: Http_Content_Length=0, got: %s\n", val)
|
||||
}
|
||||
if !strings.Contains(val, "Http_Custom_Header") {
|
||||
t.Errorf("'env' should printed: Http_Custom_Header, got: %s\n", val)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user