canonic-epicure / KiokuJS-Backend-CouchDB

CouchDB backend for KiokuJS
3 stars 1 forks source link

Trying to store UTF-8 chars fails with 400 error #2

Closed bergmark closed 9 years ago

bergmark commented 13 years ago

Stumbled upon this bug:

require('task-joose-nodejs');
use('KiokuJS.Backend.CouchDB', function () {
  var url = "http://localhost:5984/test";
  var handle = new KiokuJS.Backend.CouchDB({ dbURL : url });
  handle.newScope().store({ name : "ö" }).now();
});

This code generates the following HTTP request

{"className":"Object","isRoot":true,"data":{"name":"ö"},"$entry":true,"_id":"5BB35415-C202-7AA1-910B-0DDF288782F9"}

To which Couch responds

{ status: 400, text: '{"error":"bad_request","reason":"invalid UTF-8 JSON"}\n' }

Not sure where the problem lies. Any ideas?

bergmark commented 13 years ago

Emacs says the file i tested is utf-8, by the way

bergmark commented 13 years ago

Bug was in HTTP-Request-Provider, Fix available at https://github.com/SamuraiJack/HTTP-Request-Provider/pull/1