- Apply the resources.yaml file
kubectl apply -f resources.yaml -n <namespace>
- This will deploy a default InMemory Broker, a Trigger filtering by
source: /from/ping
and a custom event display, so we can see the content-type header. - Run the following command from your terminal to create a temporary container to run curl:
kubectl run curl --image=radial/busyboxplus:curl -i --tty --rm
- In a new terminal window, run:
watch kubectl logs -l serving.knative.dev/service=cloudevent-display -c user-container
- Send this request in the terminal of step #3:
curl -vvv -X POST -H "content-type: application/cloudevents+json" \
-d '{"specversion": "1.0", "type": "ping", "id": "123456", "source": "/from/ping", "data": {"message": "Hello world!"}}' \
<broker internal URL>
- You should see no content-type in the event-display logs:
Ce-Source=/from/ping
Ce-Specversion=1.0
Ce-Type=ping
Forwarded=for=10.131.2.6;proto=http
K-Proxy-Request=activator
Traceparent=00-a1e415d80e39a33debb33420b9a87840-1e8a7713586c1dfe-00
X-Forwarded-For=10.131.2.6, 10.131.2.22
X-Forwarded-Proto=http
X-Request-Id=2f2e1e1b-3fd0-400a-ac78-0bbdf710942f
- Now run this:
curl -vvv -X POST -H "content-type: application/json" \
-H "ce-specversion: 1.0" \
-H "ce-source: /from/ping" \
-H "ce-type: ping" \
-H "ce-id: 123456" \
-d '{"message": "Hello world!"}' \
<broker internal URL>
You should see the correct content-type:
Ce-Specversion=1.0
Ce-Type=ping
Content-Type=application/json
Forwarded=for=10.131.2.6;proto=http
K-Proxy-Request=activator
Traceparent=00-1847ca93971bd3385ddeaf760c70c0fa-71e109a039a3beff-00
X-Forwarded-For=10.131.2.6, 10.130.2.5
X-Forwarded-Proto=http
X-Request-Id=b10d34ba-0677-4c58-b199-6d64044a7f5e