Re: Debugging bad requests with vibe

2018-02-09 Thread rjframe via Digitalmars-d-learn
On Fri, 09 Feb 2018 15:48:54 +, Nicholas Wilson wrote:

> On Friday, 9 February 2018 at 08:06:53 UTC, Seb wrote:
>> On Thursday, 8 February 2018 at 17:09:44 UTC, Nicholas Wilson wrote:
>>> Is there a way I can see/log what requests are being made? I can
>>> change both the client and server.
>>
>> -v and -vv
> 
> So it turns out that structs do not work as parameters TO rest interface
> functions.
> 
> https://github.com/vibe-d/vibe.d/issues/2067

I have a project doing this; I think I solved that (or something) with:

```
@path("/api/")
interface RestAPI {
// stuff
}
```

I cannot reproduce your problem with that code though to see if it will 
work.


Re: Debugging bad requests with vibe

2018-02-09 Thread Nicholas Wilson via Digitalmars-d-learn

On Friday, 9 February 2018 at 08:06:53 UTC, Seb wrote:
On Thursday, 8 February 2018 at 17:09:44 UTC, Nicholas Wilson 
wrote:
Is there a way I can see/log what requests are being made? I 
can change both the client and server.


-v and -vv


So it turns out that structs do not work as parameters TO rest 
interface functions.


https://github.com/vibe-d/vibe.d/issues/2067


Re: Debugging bad requests with vibe

2018-02-09 Thread tetyys via Digitalmars-d-learn

On Friday, 9 February 2018 at 11:46:31 UTC, Nicholas Wilson wrote:

On Friday, 9 February 2018 at 08:06:53 UTC, Seb wrote:
On Thursday, 8 February 2018 at 17:09:44 UTC, Nicholas Wilson 
wrote:
Is there a way I can see/log what requests are being made? I 
can change both the client and server.


-v and -vv


All that gives me is a bunch of
[FAC3BFF6:FAC451F6 dia] Actively closing TCP connection

is there a way to get the JSON being sent?


Try Fiddler, great tool too


Re: Debugging bad requests with vibe

2018-02-09 Thread Arjan via Digitalmars-d-learn

On Friday, 9 February 2018 at 11:46:31 UTC, Nicholas Wilson wrote:

On Friday, 9 February 2018 at 08:06:53 UTC, Seb wrote:
On Thursday, 8 February 2018 at 17:09:44 UTC, Nicholas Wilson 
wrote:
Is there a way I can see/log what requests are being made? I 
can change both the client and server.


-v and -vv


All that gives me is a bunch of
[FAC3BFF6:FAC451F6 dia] Actively closing TCP connection

is there a way to get the JSON being sent?


Wireshark?


Re: Debugging bad requests with vibe

2018-02-09 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 8 February 2018 at 20:24:19 UTC, Nicholas Wilson 
wrote:
On Thursday, 8 February 2018 at 17:09:44 UTC, Nicholas Wilson 
wrote:
I have set up a vibe.d rest interface (on a server) and have a 
client on my machine.


struct Observation
{
string desc;
DateTime time;
}

interface Obsever
{
@property void observe(Observation ra);
}

void main()
{
auto test = Observation("a duck", 
cast(DateTime)Clock.currTime(UTC()));


auto client = new RestInterfaceClient! 
Obsever("http://example.com/observation;);

client. observe = test; // 400
}

I' pretty sure the url is correct because other ones give 404.

Is there a way I can see/log what requests are being made? I 
can change both the client and server.


Never mind, it was because I was accidentally shadowing that 
path with a get on the server.


Hmm, nope it wasn't that.


Re: Debugging bad requests with vibe

2018-02-09 Thread Nicholas Wilson via Digitalmars-d-learn

On Friday, 9 February 2018 at 08:06:53 UTC, Seb wrote:
On Thursday, 8 February 2018 at 17:09:44 UTC, Nicholas Wilson 
wrote:
Is there a way I can see/log what requests are being made? I 
can change both the client and server.


-v and -vv


All that gives me is a bunch of
[FAC3BFF6:FAC451F6 dia] Actively closing TCP connection

is there a way to get the JSON being sent?


Re: Debugging bad requests with vibe

2018-02-09 Thread Seb via Digitalmars-d-learn
On Thursday, 8 February 2018 at 17:09:44 UTC, Nicholas Wilson 
wrote:
Is there a way I can see/log what requests are being made? I 
can change both the client and server.


-v and -vv


Re: Debugging bad requests with vibe

2018-02-08 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 8 February 2018 at 17:09:44 UTC, Nicholas Wilson 
wrote:
I have set up a vibe.d rest interface (on a server) and have a 
client on my machine.


struct Observation
{
string desc;
DateTime time;
}

interface Obsever
{
@property void observe(Observation ra);
}

void main()
{
auto test = Observation("a duck", 
cast(DateTime)Clock.currTime(UTC()));


auto client = new RestInterfaceClient! 
Obsever("http://example.com/observation;);

client. observe = test; // 400
}

I' pretty sure the url is correct because other ones give 404.

Is there a way I can see/log what requests are being made? I 
can change both the client and server.


Never mind, it was because I was accidentally shadowing that path 
with a get on the server.


Debugging bad requests with vibe

2018-02-08 Thread Nicholas Wilson via Digitalmars-d-learn
I have set up a vibe.d rest interface (on a server) and have a 
client on my machine.


struct Observation
{
string desc;
DateTime time;
}

interface Obsever
{
@property void observe(Observation ra);
}

void main()
{
auto test = Observation("a duck", 
cast(DateTime)Clock.currTime(UTC()));


auto client = new RestInterfaceClient! 
Obsever("http://example.com/observation;);

client. observe = test; // 400
}

I' pretty sure the url is correct because other ones give 404.

Is there a way I can see/log what requests are being made? I can 
change both the client and server.