You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing the status code of the response with res.setStatusCode(212) (similar to res.setBody()) should be possible.
Current Behaviour
Changing the status code doesn't change the response's status code. No matter what code is set, the java11 template always responds with "200".
Possible Solution
Wrong handling of the Status Code?
Steps to Reproduce (for bugs)
Create java11 template
Add line to Handler.java code: res.setStatusCode(202) or whatever number
Build, push deploy java11 template
Invoke or curl java11 function
Get wireshark, or any other network sniffer and trace down the network traffic between openfaas and your pc
Context
I need custom status codes for http communication and I'm not able to set them properly.
I troubleshot the deployment (on Openshift) with using the write_debug: true setting in the .yaml-file.
This is the log of my deployment:
2020/10/22 10:07:48 Started logging stderr from function.
2020/10/22 10:07:48 Started logging stdout from function.
2020/10/22 10:07:48 OperationalMode: http
2020/10/22 10:07:48 Timeouts: read: 10s, write: 10s hard: 10s.
2020/10/22 10:07:48 Listening on port: 8080
2020/10/22 10:07:48 Writing lock-file to: /tmp/.lock
2020/10/22 10:07:48 Metrics listening on port: 8081
2020/10/22 10:08:01 POST /function/java11 - 212 - ContentLength: 35
2020/10/22 10:08:01 stdout: Request / 35 bytes written.
As you can see, the code is set properly there (from 200 to 212).
The problem is, when I log the network traffic between my client, which sends the curl (or invokes the function through the UI), this is the HTTP stream output (taken from wireshark):
I guess the res.setStatusCode() is overwritten by the default handling of HTTP requests?
The response status in the UI of openfaas (under http://:8080) is also always set to 200, no matter what status code i set. Am I doing something wrong?
Your Environment
Docker version docker version (e.g. Docker 17.0.05 ):
Version: 19.03.8
Are you using Docker Swarm or Kubernetes (FaaS-netes)?
oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
Running on Openshift cluster under project/namespace openfaas-fn (for my functions)
Operating System and version (e.g. Linux, Windows, MacOS):
CentOS 7
The text was updated successfully, but these errors were encountered:
Expected Behaviour
Changing the status code of the response with
res.setStatusCode(212)
(similar tores.setBody()
) should be possible.Current Behaviour
Changing the status code doesn't change the response's status code. No matter what code is set, the java11 template always responds with "200".
Possible Solution
Wrong handling of the Status Code?
Steps to Reproduce (for bugs)
res.setStatusCode(202)
or whatever numberContext
I need custom status codes for http communication and I'm not able to set them properly.
I troubleshot the deployment (on Openshift) with using the
write_debug: true
setting in the .yaml-file.This is the log of my deployment:
As you can see, the code is set properly there (from 200 to 212).
The problem is, when I log the network traffic between my client, which sends the curl (or invokes the function through the UI), this is the HTTP stream output (taken from wireshark):
I guess the
res.setStatusCode()
is overwritten by the default handling of HTTP requests?The response status in the UI of openfaas (under http://:8080) is also always set to 200, no matter what status code i set. Am I doing something wrong?
Your Environment
Docker version
docker version
(e.g. Docker 17.0.05 ):Version: 19.03.8
Are you using Docker Swarm or Kubernetes (FaaS-netes)?
oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
Running on Openshift cluster under project/namespace openfaas-fn (for my functions)
Operating System and version (e.g. Linux, Windows, MacOS):
CentOS 7
The text was updated successfully, but these errors were encountered: