akamai / AkamaiOPEN-edgegrid-golang

This library implements an Authentication handler for the Akamai OPEN EdgeGrid Authentication scheme
Apache License 2.0
90 stars 69 forks source link

DXE-2723 Network Lists: missing error handling in CreateActivations() #187

Closed atefhaloui closed 1 year ago

atefhaloui commented 1 year ago

Hi, I'm playing with the networklists API and it seems that when a 4xx happens when activating a network list the error is not handled. Instead, in the function CreateActivations() just after the call to p.Exec(req, &rval, params) we're not making a check to resp.StatusCode but we're trying to get the new activation status directly --> this call will succeed and the entire call to CreateActivations() will succeed.

I think that we must add the following check on line 353 (based on v6.0.0):

    if resp.StatusCode != http.StatusOK {
        return nil, p.Error(resp)
    }

Cheers

dawiddzhafarov commented 1 year ago

Hi @atefhaloui,

Thank You for opening the issue. At first glance it seem that You are right and those 3 lines of code are missing. We will investigate it further and fix it.

With regards, Dawid

atefhaloui commented 1 year ago

Hi, As a side note, I used to get 401 errors when activating a list while all my calls are correct: this drive me crazy for some time. After further investigation, I realized that I'm not correctly initializing the edgedrid.MaxBody field ; as I'm initalializing the edgegrid.Config structure externally using my yaml global config file, I've missed to set it to edgegrid.MaxBodySize if the field is not set (equal to 0). I think that this should be more explained in the documentatin.

Cheers

dawiddzhafarov commented 1 year ago

Hi,

Thank You for the feedback. Could You please provide sample configuration You have used (without any sensitive information)? When MaxBody is not provided, it should default to MaxBodySize automatically. Please also provide information about the environment: operating system, edgegrid-golang version.

With regards, Dawid

atefhaloui commented 1 year ago

Hi Dawid, As I said, this is a simple documentation issue ;) In my case, my environment is:

Sincerely, Atef

lkowalsk-akamai-com commented 1 year ago

This issue is now fixed with recent release