VisualJSON icon indicating copy to clipboard operation
VisualJSON copied to clipboard

Allow requests to local domains.

Open gvino opened this issue 11 years ago • 9 comments

Now when I tried to send request to http://test-server.dev/login, for example I see an error:

{
    "class": "NSError",
    "code": 3840,
    "domain": "NSCocoaErrorDomain",
    "reason": "The data has been corrupted."
}

gvino avatar Aug 20 '13 15:08 gvino

VisualJSON doesn't determine your URL is local or not. I usually use this application with localhost. Could you open the URL with other application? I guess if safari can open it, VisualJSON also opens it.

youknowone avatar Aug 20 '13 15:08 youknowone

Now I test this service with Poster addon to Firefox and it works fine, so it's a bug in VisualJSON. 2013-08-20 19 49 32

gvino avatar Aug 20 '13 15:08 gvino

Firefox use non-OS connection - but I don't think you set it up different network environment. I still don't know what is happening. I can connect to any server listed in /etc/host Do you have any idea to allow me to test your environment or replicate it to my machine?

youknowone avatar Aug 21 '13 01:08 youknowone

Safari opens this host too.

To replicate my environment you need to have:

  • rvm
  • ruby 1.9.3 installed through rvm
  • Pow

With this up and running:

$ mkdir /sinatra/app/path
$ echo '1.9.3' > /sinatra/app/path/.ruby-version && echo 'my-test-gemset' > /sinatra/app/path/.ruby-gemset
$ cd /sinatra/app/path
$ rvm env > .powenv
$ gem install powder && gem install sinatra && gem install sinatra-contrib
$ touch server.rb && touch config.ru

In server.rb:

require 'sinatra'
require 'sinatra/json'

post '/login' do
    params.inspect
    if params[:email] == '[email protected]' and params[:password] == '123qwe'
        [200, json({status: 'ok'})]
    else
        [401, json({status: 'login information is incorrect'})]
    end
end

get '/*:format?' do
    params.inspect
end

In config.ru:

require './server'
run Sinatra::Application

After all do in terminal inside folder with config.ru

$ powder link

Now you can open in Safari your sinatra app with URL given by Pow.

gvino avatar Aug 21 '13 09:08 gvino

Have same behavior when server responds with 400 Bad Request.

When a server being tested responds with 200 - response is shown under the Tree section. When the response code is 400 - I have the same error as @gvino wrote.

paranoicsan avatar Aug 28 '13 10:08 paranoicsan

It looks like you drop all responses, except 200.

gvino avatar Aug 28 '13 10:08 gvino

#28 seems solve this problem

youknowone avatar Sep 01 '13 18:09 youknowone

Preview of 1.6: http://youknowone.github.io/VisualJSON/downloads/VisualJSON%201.6.pkg

youknowone avatar Sep 01 '13 19:09 youknowone

@youknowone hmm. same bug.. using last VisualJSON from App Store Version 1.6.0 (1.6.0)

Have project running on localhost( MAMP ) & remote test server. Queries to localhost have 3840 error, and queries to test server have success..

vburlak avatar Oct 13 '14 18:10 vburlak