With the following commits === Name: Zinc-Resource-Meta-Core-SvenVanCaekenberghe.63 Author: SvenVanCaekenberghe Time: 25 August 2017, 4:51:26.632889 pm UUID: b81e01d1-f613-0d00-b8a2-b72f05cf217b Ancestors: Zinc-Resource-Meta-Core-SvenVanCaekenberghe.62
Adapt ZnUrl>>#parsePath: to allow for empty path segments (as would happen when 2 consecutive slash occur in it) - simplify some of the code Modify #testEncodedSlash and #testParsingEmpty in ZnUrlTests to follow the new behavior === Name: Zinc-Resource-Meta-Tests-SvenVanCaekenberghe.38 Author: SvenVanCaekenberghe Time: 25 August 2017, 4:51:43.080273 pm UUID: 4116fcd1-f613-0d00-b8a3-a70905cf217b Ancestors: Zinc-Resource-Meta-Tests-SvenVanCaekenberghe.37 Adapt ZnUrl>>#parsePath: to allow for empty path segments (as would happen when 2 consecutive slash occur in it) - simplify some of the code Modify #testEncodedSlash and #testParsingEmpty in ZnUrlTests to follow the new behavior === Empty path segments are allowed and your example will work. Since it returns JSON, I would suggest doing ZnClient new accept: ZnMimeType applicationJson; enforceAcceptContentType: true; contentReader: [ :entity | STONJSON fromString: entity contents ]; get: 'https://archive.softwareheritage.org/api/1/origin/git/url/https://github.com/hylang/hy'. > On 17 Aug 2017, at 18:51, Sven Van Caekenberghe <s...@stfx.eu> wrote: > > Hi Milton, > >> On 5 Aug 2017, at 03:15, milton mamani <akeval...@gmail.com> wrote: >> >> Hi to all >> >> I want to use the next instruction in my code >> >> response := ZnEasy get: >> 'https://archive.softwareheritage.org/api/1/origin/git/url/https://github.com/hylang/hy'. >> response. >> >> The previous code works from command line or in a webbrowser, but I does not >> work with ZnEasy >> Because it takes the previous link as: >> a ZnRequest(GET /api/1/origin/git/url/https:/github.com/hylang/hy) >> >> Could you please tell me what can I do for this situation? >> >> Cheers, >> Milton > > ZnUrl has indeed a problem parsing this URL. It skips empty path segments, > we'll have to create an issue for that and we should try to fix it, > maintaining current behaviour. The parser is hand written and has evolved a > bit over the years, so it is a bit brittle. Seaside's WAUrl seems to have the > same problem. It is funny that this only now comes up. Thanks for reporting > it. > > Here is a workaround, by manually creating a ZnUrl object from its elementary > components. > > ZnUrl new scheme: #https; host: 'archive.softwareheritage.org'; > addPathSegments: #('api' '1' 'origin' 'git' 'url' 'https:' '' 'github.com' > 'hylang' 'hy'); yourself. > > You can use this as follows. > > ZnUrl new scheme: #https; host: 'archive.softwareheritage.org'; > addPathSegments: #('api' '1' 'origin' 'git' 'url' 'https:' '' 'github.com' > 'hylang' 'hy'); retrieveContents. > > ZnEasy get: (ZnUrl new scheme: #https; host: 'archive.softwareheritage.org'; > addPathSegments: #('api' '1' 'origin' 'git' 'url' 'https:' '' 'github.com' > 'hylang' 'hy'); yourself). > > Regards, > > Sven >