What is the DataWeave expression to log the Content-Type header using a Logger component?

A flow contains an HTTP Listener as the event source .

What is the DataWeave expression to log the Content-Type header using a Logger component?
A . #["Content-Type: " ++ attributes.headers.’content-type’]
B . #["Content-Type: " + headers.’content-type’]
C . #["Content-Type: " + attributes.headers.’content-type’]
D . #["Content-Type: " ++ headers.’content-type’]

Answer: A

Explanation:

Option 1 is the only correct choice due to two reasons. 1) Concatenation is always with ++ sign and not with + sign which makes option 2 and 3 wrong 2) hearders can be accessed with attributes. headers and not with only headers which makes option 4 incorrect

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments