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

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.