Determine the Request

Report a typo

Look at the handler method definition and choose the request that can be handled by it:

Java
@PostMapping(value = "/products")
public String addProduct(@RequestBody Product productToAdd)
Kotlin
@PostMapping(value = ["/products"])
fun addProduct(@RequestBody productToAdd: Product): String

Requests:

1

POST http://localhost:8080/products
Content-Type: application/json

[
  {
    "id" : "290",
    "productType":"Paper"
  },
  {
    "id" : "832",
    "productType":"Pen"
  }
]

2

POST http://localhost:8080/products
Content-Type: application/xml

[
  {
    "id" : "290",
    "productType":"Paper"
  },
  {
    "id" : "832",
    "productType":"Pen"
  }
]

3

POST http://localhost:8080/products
Content-Type: application/xml

{
    "id" : "290",
    "productType":"Paper"
}

4

POST http://localhost:8080/products
Content-Type: application/json

{
    "id" : "290",
    "productType":"Paper"
}
Select one option from the list
___

Create a free account to access the full topic