splunk-sdk-python icon indicating copy to clipboard operation
splunk-sdk-python copied to clipboard

HttpLib#request has strange argument names

Open ansman opened this issue 15 years ago • 2 comments

If you look at how Context#request calls HttpLib#request it looks like this:

    return self.http.request(
        self.url(path), {
            'method': message.get("method", "GET"),
            'headers': message.get("headers", []) + self._headers(),
            'body': message.get("body", "")})

But if you look at the signature for HttpLib#request:

def request(self, url, headers=None, **kwargs):

And in turn when that calls the Handler#request the signature is:

def request(url, message, **kwargs):

Why is the second argument of HttpLib#request named headers when it's clearly the message argument later?

ansman avatar Nov 08 '11 18:11 ansman

Good catch, that seems clearly wrong.

blovering avatar Feb 28 '12 18:02 blovering

Name fixed. We were passing the message through the incorrectly named headers param. Name was a leftover from a previous design iteration.

blovering avatar Feb 28 '12 19:02 blovering