Closed Discountrobot closed 8 years ago
Thanks @Discountrobot, both are great considerations! :) I've merged, but in fact, I have some thoughts about this issue:
JSON.stringify
manuallyhttp://localhost?filter=undefined
could be confusing, when you accidentally pass sg undefined and debug it with capturing network communication. What do you think?
ps: sorry for Travis error, I'm working on CI build (and test).
After reviewing, i actually agree - that stringifying should happen outside of the base rest-client :)
As for the filtering, marking a query as optional, will still add it to the paramBuilder descriptor - regardless of the value
@GET("/")
public find( @Query("filter") filter?: IFilter): Promise<any> { return null }
// SomeService.find() => http://localhost?filter=undefined
// SomeService.find('something') => http://localhost?filter=something
Also, why have you chosen to implement the IRequest
interface, rather than implementing the https://angular.io/docs/ts/latest/api/http/RequestOptions-class.html ?
I'll look after why optional params not working, it was correct before, without any filtering.
You're right, RequestOptions
is much better for request encapsulation (and later, for response). The only reason for using custom IRequest
is not having enough time to look after the Angular2 way for that :)
Came across a minor issue when passing objects as querystrings :) this patch includes fixes for:
JSON.stringified
resulting in objects being passed as"http://localhost?filter=[object Object]"
http://localhost?filter=undefined