jsondatacontext-linqpad icon indicating copy to clipboard operation
jsondatacontext-linqpad copied to clipboard

About web call setting problem

Open wellxion opened this issue 9 years ago • 3 comments

When I setting url like this : http://172.17.13.140:8080/web/P2PServer.jsp?cache_mode=false&action=search&txtInput_json={"test" : ""} It will compile context fail

It Seems like general code cause some bug?

By the way, web call UI is not so friendly, it confused me at first use

wellxion avatar Aug 20 '15 08:08 wellxion

Hi!

Are you able to share the output of http://172.17.13.140:8080/web/P2PServer.jsp?cache_mode=false&action=search&txtInput_json={"test" : ""}? It may be that the returned json has something in it that breaks the driver.

Otherwise, you might also try setting the URL to http://172.17.13.140:8080/web/P2PServer.jsp?cache_mode=false&action=search&txtInput_json={%22test%22%20:%20%22%22} (already url-encoded) as a quick test; in case there is some error in the URL handling itself.

Finally - if you have any suggestions or specific complaints about the UI, please share and I can look at improving :+1:

rdavisau avatar Aug 20 '15 08:08 rdavisau

First, it is break berfore trying to get request, linqpad return an error dialog: image

I think the problem is driver generated code cause compile fail, look at code:

using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
using System.Web;
using JsonDataContext;
using LINQPad.User.testInput;

namespace LINQPad.User {
 public class TypedDataContext : JsonDataContextBase {
        public IEnumerable<LINQPad.User.testInput.test> tests { get { return GetUrlParameterlessInput<LINQPad.User.testInput.test>(@"http://172.17.13.140:8080/web/P2PServer.jsp?cache_mode=false&action=search&txtInput_json={"test" : ""}", new List<Tuple<string,string>> { Tuple.Create("Accept","application/json; text/json") }); } }
}
}

namespace LINQPad.User.testInput
{
    public partial class test
    {
        [JsonProperty("error_code")]
        public double error_code { get; set; }
        [JsonProperty("error_msg")]
        public string error_msg { get; set; }
    }
}

Double quotes will break the string and cause it compile fail, I tried to change all quotes to single quotes to solve that problem yesterday. And then, I will try url encode to test, but I think it is not a best solution.

Finally, The first confusing is web call UI doesn't have a edit button, it waste me lot of time to find the way to edit input settints. And other suggestions is you can follow Postman UI design, like seperate Get and Post parameter setting, It maye be better.

By the way, I realy like method setting in web call, that a good idea. :laughing:

wellxion avatar Aug 21 '15 02:08 wellxion

Thanks for the information -- I'll sort this out over the next day or two :+1:

rdavisau avatar Aug 23 '15 11:08 rdavisau