MuleSoft Certified Developer – Level 1 — Question 88
What is the DataWeave expression to log the Content-Type header using a Logger component?
Answer options
- A. #["Content-Type: " ++ attributes.headers.'content-type']
- B. #["Content-Type: " ++ headers.'content-type']
- C. #["Content-Type: " + headers.'content-type']
- D. #["Content-Type: " + attributes.headers.'content-type']
Correct answer: A
Explanation
The correct answer is A because it correctly references the 'content-type' header within the 'attributes' object, which is essential for logging the header properly. Option B is incorrect as it uses 'headers' instead of 'attributes', while options C and D incorrectly use a different concatenation operator which may lead to unexpected results.