confusing error Message if a function is called the wrong way
emanuelParicon opened this issue · 3 comments
hi,
I noticed that the Error messages while trying to call an Function import are a little bit confusing,
cause if I call a Function import without Parameters the Response tells me that the function for the function import cannot be found.
I tried the following requests by cloning this repository and starting the hello and the bookshop example with
npm i ./hello/ && cds serve ./hello/world.cds
npm i ./bookshop/ && PORT=8080 cds watch ./bookshop/
### function import call without parameter
GET http://localhost:4004/say/hello
### response: 400 Could not find function for function import 'hello'
### function import call with OData V2 syntax
GET http://localhost:4004/say/hello?to='jhon'
### response: 400 Could not find function for function import 'hello'
### working function import call
GET http://localhost:4004/say/hello(to='jhon')
### response: 200 Hello jhon!
GET http://localhost:8080/browse/Books
If I try to Call an Action however the Error messages are self-explanatory.
### action call without headers and payload
POST http://localhost:8080/browse/submitOrder
### response: 400 Invalid value "undefined" in content-type header
### action call without payload
POST http://localhost:8080/browse/submitOrder
Content-Type: application/json
### response: 400 Error while deserializing payload
### action call with bad payload
POST http://localhost:8080/browse/submitOrder
Content-Type: application/json
{
"book": 207
"amount": 10
}
### response: Error while deserializing payload. Unexpected string in JSON at position 24.
### working action call
POST http://localhost:8080/browse/submitOrder
Content-Type: application/json
{
"book": 207,
"amount": 10
}
### response: 204 No Content
@AnneKeller01 can you take this?
We are currently improving our messages and will look into this also. @emanuelParicon, thanks for opening the issue.
Hi @emanuelParicon,
We haven't heard from you in a while, so we are closing the issue. If you still have questions, feel free to open a new issue.
Best regards,
Iwona