MuleSoft Certified Developer – Level 1 — Question 107
A web client sends a request to http://localhost:8081?dept=sales.
What is the correct DataWeave expression to access the value of dept?
Answer options
- A. attributes.queryParams.dept
- B. attributes.dept
- C. message.queryParams.dept
- D. vars.dept
Correct answer: A
Explanation
The correct answer is A, as 'attributes.queryParams.dept' properly accesses the query parameter 'dept' from the request attributes. Option B is incorrect because 'attributes.dept' does not refer to a query parameter. Option C is not correct since 'message.queryParams.dept' is not the right context for accessing query parameters in this scenario. Option D fails because 'vars.dept' is used for variable storage, not for accessing query parameters.