Or maybe just trim the response string.
* * *
This is clearly a Redmine problem, not lua-Spore one — they should
respond with some XML data.
However, buggy server implementations will always be there, no matter
what. It would be great if lua-Spore would allow specification writer
to handle them.
Of course, the bug in server must be fixed, but there are thousands of
Redmine installations out there — who knows when they would be
updated, and, furthermore Redmine is released only once in every six
months. Developers just have to live with that.
Same reasoning holds true for any server out there. Bugs, of course
must be reported and fixed, but it takes time, and the code should
work "now". :-)
François, what do you think?
I, myself, do not think that the suggested solution is generic enough
to be included in lua-Spore, but, maybe, you could allow service
description author to provide a pre-filter function for server
response string, or something like this?
Thanks,
Alexander.
Shouldn't the regexp be something like '^%s*%S.*$'? Or am I missing the point?
> or (when paranoia is a good thing) :
> if type(res.body) == 'string' and not res.body:match'^%s*$' then
Well, that approach should work for us, so, no problem.
Can you please make that change in the code?
Thanks,
Alexander.
yes, we definitely need to realize that it's a "not common" case, and
common middle wares provided with SPORE should only take care about
common case. That's the reason I wanted middle wares in SPORE, so you
don't have to put all the weird cases in core.
>>
>> > Before version 0.1.2, the test is only :
>> > if res.body then
>> > with the commithttps://github.com/fperrad/lua-Spore/commit/330bde0bbde2e6610ce1dc256...,
>> > it becomes :
>> > if res.body and res.body ~= '' then
>>
>> > In my point of view (I am a regexp fan), the next step is :
>> > if res.body and not res.body:match'^%s*$' then
>>
>> Shouldn't the regexp be something like '^%s*%S.*$'? Or am I missing the point?
>
> the current code could be rewritten :
> if res.body and not res.body == '' then
> and my proposal is :
> if res.body and not res.body:match'^%s*$' then
>
> so, I think you miss the *not*.
>
> François
that's a good solution. I'll also apply this on Net::HTTP::Spore in
the Perl land.
>
>>
>> > or (when paranoia is a good thing) :
>> > if type(res.body) == 'string' and not res.body:match'^%s*$' then
>>
>> Well, that approach should work for us, so, no problem.
>>
>> Can you please make that change in the code?
>>
>> Thanks,
>> Alexander.
--
franck cuny
Ah, yes, of course :-)
Thanks,
Alexander.