On 09/15/2011 11:17 AM, Tomas Sedovic wrote:
> On 09/15/2011 09:02 AM, jprovazn(a)redhat.com wrote:
>> Sending rebased version
>>
>> _______________________________________________
>> aeolus-devel mailing list
>> aeolus-devel(a)lists.fedorahosted.org
>>
https://fedorahosted.org/mailman/listinfo/aeolus-devel
>
> Hi Jan,
>
Hi,
> As a side note, please make sure that you set the subject of the
> patch-accompanying email to contain the string 'PATCH'.
>
> There was a previous discussion where we decided to do than instead
> splitting this mailing list in two. People interested only in the
> discussion can filter the patch emails out.
>
Ah, thanks for notification - I had to miss the mail.
>
> The patchset looks great but I can't get it to respond with JSON data.
> Which is more confusing as the tests pass and they seem to be checking
> that.
>
> I tried it with (cookie-authenticated) cURL request:
>
> $ curl --header "Accept: application/json" --header "Cookie:
> _session_id=<snip>" -v
http://localhost:3007/catalogs
> * About to connect() to localhost port 3007 (#0)
> * Trying ::1... Connection refused
> * Trying 127.0.0.1... connected
> * Connected to localhost (127.0.0.1) port 3007 (#0)
> > GET /catalogs HTTP/1.1
> > User-Agent: curl/7.21.3 (x86_64-redhat-linux-gnu) libcurl/7.21.3
> NSS/3.12.10.0 zlib/1.2.5 libidn/1.19 libssh2/1.2.7
> > Host: localhost:3007
> > Accept: application/json
> > Cookie:
>
_session_id=BAh7CiIPc2Vzc2lvbl9pZCIlYWVhMTFlZmEwZWU4NDgxZThlZTU1NWEyZWE4YzZmYTUiGXdhcmRlbi51c2VyLnVzZXIua2V5aQYiF2phdmFzY3JpcHRfZW5hYmxlZEYiEGJyZWFkY3J1bWJzWwAiCmZsYXNoSUM6JUFjdGlvbkRpc3BhdGNoOjpGbGFzaDo6Rmxhc2hIYXNoewY6C25vdGljZSIWTG9naW4gc3VjY2Vzc2Z1bCEGOgpAdXNlZG86CFNldAY6CkBoYXNoewA%3D--518f906b8169106de0ba16ab4f702427356a0108;
> path=/; HttpOnly
> >
> < HTTP/1.1 200 OK
> < X-Ua-Compatible: IE=Edge
> < Etag: "db37154245440b0afcffcf37d056964a"
> < Connection: Keep-Alive
> < Content-Type: application/json; charset=utf-8
> < Date: Thu, 15 Sep 2011 09:08:35 GMT
> < Server: WEBrick/1.3.1 (Ruby/1.8.7/2011-06-30)
> < X-Runtime: 1.234250
> < Content-Length: 9516
> < Cache-Control: max-age=0, private, must-revalidate
> < Set-Cookie:
>
_session_id=BAh7CyIQX2NzcmZfdG9rZW4iMWYraHZjUmtrdDl4ODRvVzBuc2JIczF2RStMODkyT280dlZESnF2M29JUFU9Ig9zZXNzaW9uX2lkIiVhZWExMWVmYTBlZTg0ODFlOGVlNTU1YTJlYThjNmZhNSIZd2FyZGVuLnVzZXIudXNlci5rZXlpBiIXamF2YXNjcmlwdF9lbmFibGVkRiIQYnJlYWRjcnVtYnNbBnsJOgpjbGFzcyINY2F0YWxvZ3M6DnZpZXdzdGF0ZTA6CW5hbWVADzoJcGF0aCIOL2NhdGFsb2dzIgpmbGFzaElDOiVBY3Rpb25EaXNwYXRjaDo6Rmxhc2g6OkZsYXNoSGFzaHsGOgtub3RpY2UiFkxvZ2luIHN1Y2Nlc3NmdWwhBjoKQHVzZWRvOghTZXQGOgpAaGFzaHsGOwpU--bda0cce974fb10820445174849d1760870866e5d;
> path=/; HttpOnly
> <
> <!DOCTYPE html>
> <html lang='en' xml:lang='en'>
> <head>
> <meta charset='utf-8'>
> <title>Aeolus Conductor</title>
> ...
> <snip>
>
>
> The interesting thing to note here is that the server actually sets the
> "application/json" content-type but still returns the HTML page in the
> body.
>
>
> I tried it in the jQuery console as well with the same results:
>
> $.ajax('/catalogs/1', { dataType: 'json', success: function(d) {
> console.log(d) } })
>
> This results with the jqXHR object showing "parseerror" statusText and
> the response is HTML again.
>
Hm, this is weird behaviour, going to look at it closer today.
Hmpf, I almost went mad of this. The problem is that all our haml
templates have incorrect names (missing 'html' in name), for example
"index.haml" should be "index.html.haml". respond_with first tries to
find suitable template and "index.haml" is matched even for json response.
Going to send patch which fixes template filenames first, then this
patch will work.
> Thomas
Thanks for review. Jan
_______________________________________________
aeolus-devel mailing list
aeolus-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/aeolus-devel