Closed kdtp28 closed 9 months ago
Hi Karsten,
Thanks for reporting this issue. However, I'm not able to reproduce the behavior you describe.
j←Jarvis.New '' ⍝ create a new Jarvis server
j.Paradigm←'REST' ⍝ set the Paradigm
⍝ now define some endpoints
Get←{⍵.(Method Endpoint Body)}
Post←{⍵.(Method Endpoint Body)}
Delete←{⍵.(Method Endpoint Body)}
j.Start
Start[3] 2024-02-08 @ 12.53.33.486 - Starting Jarvis 1.16.3
LoadConga[32] 2024-02-08 @ 12.53.33.501 - Conga copied from C:\Program Files\Dyalog\Dyalog APL-64 18.2 Unicode/ws/conga
LoadConga[44] 2024-02-08 @ 12.53.33.501 - Local Conga v4.3 reference is #.Jarvis.[LIB]
Start[83] 2024-02-08 @ 12.53.33.517 - Jarvis starting in "REST" mode on port 8080
Start[84] 2024-02-08 @ 12.53.33.520 - Serving code in #
0 Server started
⍝ I use HttpCommand to test
h←HttpCommand.New ''
h.BaseURL←'localhost:8080'
h.(Command URL)←'Get' 'getme'
h.Show
GET /getme HTTP/1.1
Host: localhost:8080
User-Agent: Dyalog-HttpCommand/5.4.4
Accept: */*
Accept-Encoding: gzip, deflate
h.Run.Data ⍝ run it and return the response payload
["get","/getme",""]
h.(Command URL)←'post' 'postme' ⍝ now try POST
h.Run.Data
["post","/postme",""]
h.(Command URL)←'delete' 'deleteme' ⍝ now try DELETE
h.Run.Data
["delete","/deleteme",""]
Have you verified that Jarvis is getting the requests? You can set Debug←2
on the Jarvis instance and it will stop just prior to calling any of your code.
I hope this helps! /Brian
Fixed in a02f51491ed5808f4219b37cc82836162944dd83 (release v1.17.0).
This was an interesting issue. Because of the discrepancy in behavior between what Karsten was seeing with Insomnia and what I was seeing using HttpCommand, I decided to investigate further and installed Insomnia. There is a subtle difference in behavior between the two:
Jarvis was not picking up on the "content-length: 0" header and as such was expecting an HTTPBody event, which never came, and so the system seemed to hang.
Thanks a lot. Good work. That was all a needed.
I dived a little bit into the http protocol and found the following: https://www.rfc-editor.org/rfc/rfc7230#section-3.3.3 Especially starting with Point 4, it becomes more complicated.
Karsten
I created simple functions for Get, Post, Put, ... like so:
Then I issued a request from Insomnia.
For Get everything works fine. For all other methods, I need something in my request body to make it work. Otherwise jarvis ignores it.
Especially for Delete this makes no sense to me.
Help needed, Thx, Karsten
│Jarvis│1.16.3│2024-01-12│