VisualJSON
VisualJSON copied to clipboard
Allow requests to local domains.
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."
}
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.
Now I test this service with Poster addon to Firefox and it works fine, so it's a bug in VisualJSON.
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?
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.
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.
It looks like you drop all responses, except 200.
#28 seems solve this problem
Preview of 1.6: http://youknowone.github.io/VisualJSON/downloads/VisualJSON%201.6.pkg
@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..