Thank's. It's work.
2014/1/17 Sven Van Caekenberghe <[email protected]> > Hi Denis, > > On 17 Jan 2014, at 08:31, Denis Kudriashov <[email protected]> wrote: > > > Hello. > > > > I try to investigate with pharo some http requests from external clients. > > But this code is not working: > > > > server := (ZnServer defaultOn: 1701). > > server logToTranscript. > > server > > debugMode: true; > > onRequestRespond: [ :request | request explore ]; > > start. > > > > [ZnClient new get: 'http://localhost:1701' ] fork > > > > And I get "MessageNotUnderstood: ZnRequest>>code" failure. But explorer > opened. > > Is it bug? Or maybe I am doing something wrong? > > In the #onRequestRespond: block you are supposed to return a response for > an incoming request. In your code you just return the request (from > #explore), which Zn then tries to use as a response, hence the missing > #code. Try this block: > > [ :request | request explore. ZnResponse ok: (ZnEntity text: 'OK!') ] > > BTW, if you enable #debugMode, the server itself will hold onto the last > request and response objects. So you can just use an inspector on the > server object to see what is happening. > > HTH, > > Sven > > > I am at Windows 7 > > > > Best regards, > > Denis > > >
