POST Content-type encoding
Most modern REST API’s will take a look at your request’sRead more
Content-typeheader. If the
Content-typeis declared as
application/json, then the server expects your post body to be JSON. If the
x-www-form-urlencoded, then the body should be form and url encoded. Twitter, however, will only accept x-www-form-urlencoded post bodies. Your
Content-typewill be ignored, and you will get a very unhelpful HTTP 403 status code back with an empty body. Unfortunately, this means that you will have to form and url encode your POST and PUT requests, which leads us into the next quirk.
We have an html panel that contains an Angular Directive. The code looks a little something like this:
<div class="panel-body"> <custom-directive ng-model="myModel"> </div>
The issue that we ran in to is this: we swap out the model represented byRead more
myModelall the time. On initialization, the directive’s controller sets up some listeners and fetches some resources from the backend (provided they aren’t already cached), and does some other stuff. However, the directive is not re-rendered (and thus controller initialization is not run) each time the model reference changes.
subscribe via RSS