infact it's more bizarre. refreshing the page resu...
# cfml-general
a
infact it's more bizarre. refreshing the page results in the duplicates sometimes appearing and sometimes disappearing from the
writeDump
s
unless you can repro the same result on another request to another url / provider, this seems like it would be specific to the feed you're using. we make thousands of http requests to json and xml feeds and if there were a bug in cfhttp that caused data to be duplicated, I think everybody would've run into it
a
yea it's just bizarre
I refresh the xml feed a bunch and never see them
but when cf consumes it each node seems to be duplicated on 1 out of 2 records
s
you could also compare the content-length header of the request against the actual content and make sure they match
a
I'm just dumping out
reponse.Filecontent
and it's changing
s
because if the server is saying 'your content is 12000 bytes' and the response is 12000 bytes and contains duplicates, that's the server
a
of the request or the response?
I can't see a content length in the response
s
The response should have a content-length header. All HTTP responses should
wouldn't be in filecontent though
a
no, presuambly in
.Responseheader
image.png
meh I'm going to just work around it and filter them out
annoying though
w
what you're seeing may be an artifact of using cfdump. i would suggest just outputting the text file content and verify its length, then refresh a few times and check that it's the same. if it is, then it's just a weirdity with how cfdump works internally (infrequent but i've seen it many times)
d
Do you mind sharing your cfhttp code? I’m trying to remember the details. We had some weirdness at one point when we weren’t scoping the return value. e.g.
result = 'local.result'
instead of
result = 'result'
.
s
fwiw, I find hyper (no codlbox required) to be super helpful with stuff like this, a lot easier to debug requests & responses in addition to making repeat, similar requests easy to manage
a
This could very well be the answer @danmurphy
s
it also dodges that scope issue 🙂
d
I’ve not caught the vision of hyper yet. We do a fair amount with cfhttp, but our stuff must be simple enough to not have a huge pull for something more.
s
Hyper is to cfhttp what qb is to cfquery
A builder syntax so you don't have to chain a bunch of &= together when assembling a request, and you can create request mappings with auth or headers that you re-use so you don't have to drop them in every time
On any one simple cfhttp, def not needed
But the minute you're chin-scratching and wondering what's going on or you are calling the same API 10 different ways, it's the best
d
Right. Which is overkill at times, for me (qb instead of just queryExecute).
Yeah, interesting for sure.
a
Copy code
cfhttp(method="GET", charset="utf-8", url="#api_url#", result="result", timeout=8);

            str_result = result.Filecontent;
code is simply the above. and dumping
str_result
. but 'result' is not scoped. So I'm curious as to whether dan's suggestion resolves the issue
doesn't seem to have
e
If your xml response is long try writing it out to the console or browser instead of using cfdump. There are display limitations by design for that tag.