Why does this request have a JSON content:
$http.put<void>(path, { data: 156 } , Config)
But this doesn't (It does have an empty JSON content)
http.put<void>(path, 156, Config)
?
Doesn't alone numbers are valid JSON too?
The Config
variable just holds the session token and the Key
parameter
Explanation: I have a configuration service that allows me to save Key-Value pairs on the server side. This are stored as JSON text on the database in a way that the client can save any object and then retrive it by its key. Thanks to the session token configuration values are stored per user.
Some configuration values are plain numbers and I would like to have something like this: (Note that this is TypeScript)
Config.Get<number>("Value").then( x => this.Number= x);
Config.Set("Value", this.Number);
Instead of this:
Config.Get<{ x : number }>("Value").then( x => this.Number = x.x);
Config.Set("Value", { x: this.Number });
Thanks