WP-API/WP-API — pull request #7 by rmccue (2013-11-25 05:14:44+00:00)
Title: Plugin breaks for titles with newlines

I'm trying to get a bunch of posts from a custom post type, but when i do i get an error message in php, destroying the JSON.

```
Warning: Header may not contain more than a single header, new line detected in *redacted*/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 436
```
Relevant part of the returned headers
```
Pragma: no-cache
Link: Link: ; rel="next"
X-WP-Total: 62
X-WP-TotalPages: 7
Last-Modified: Thu, 10 Oct 2013 09:57:40 GMT
Link: Link: <*redacted*/wp-json.php/posts/132>; rel="item"; title="☺️#school#love#gerls#best#lol#sweet#smile#snow#today#learning#sandess#favorite#all#in#skirts"
Link: Link: <*redacted*/wp-json.php/posts/108>; rel="item"; title="อ้วนจริงจริงเลอออ อยากผอม อยากสวย อยากสูง คงทำได้เพียง #มโน ต่อไป555"
Link: Link: <*redacted*/wp-json.php/posts/151>; rel="item"; title="สุขสันต์วันเกิดครับแม่ ลูกจะเป็นเด็กดี รักแม่ที่สุดครับ <3 @nidnoi_waranya"
Link: Link: <*redacted*/wp-json.php/posts/102>; rel="item"; title="Почти первый снег и предпоследний дождь❄️☔️#snow #clouds #rain #autumn #october #cold"
Link: Link: <*redacted*/wp-json.php/posts/120>; rel="item"; title="И норм#снег#snow#Niznevartovsk"
Link: Link: <*redacted*/wp-json.php/posts/121>; rel="item"; title="И норм#снег#snow#Niznevartovsk"
Link: Link: <*redacted*/wp-json.php/posts/111>; rel="item"; title="Всегда говорите,что чувствуете и делайте то,что думаете,молчание ломает судьбы"
Link: Link: <*redacted*/wp-json.php/posts/115>; rel="item"; title="The snow is coming. #YAY #snow #switzerland"
Link: Link: <*redacted*/wp-json.php/posts/138>; rel="item"; title="THE KING OF KINGS"
```

The requested url is as follows
*redacted*/wp-json.php/posts?type=instagram&filter[offset]=0&filter[orderby]=title

The data is just some dummy data from instagram that we create a custom post type for.

It seems that if the title contains newline characters the plugin breaks.

I believe the plugin should be able to handle it because you can so easily add newline characters in the title with wp_insert_post or any other standard way.

The filter that removes them only run when you display a title, not when you insert them.