Request-Library Cookie Too Large

In my Test,
i’m connecte with authentification oauth2.0 with selenium library on my application.
my connection is OK and I get the cookie in dictionary
after I create a session and add this coookie to used with
Get and Post on Session.

the cookie created with the connection are used after for the request.

but after created the session the first get send

 ${cookiesession}=    Get Cookies    as_dict=${True}
 ${headers}=    Get Header    
Close All Browsers
Create Session    dev1    https://tutututut.com    cookies=${cookiesession}
Log    ${cookiesession}
GET On Session    dev1    /xx/api/dddd

the reponse send :
status=400, reason=Bad Request
headers={‘Date’: ‘Thu, 13 Apr 2023 18:36:15 GMT’, ‘Content-Type’: ‘text/html’, ‘Content-Length’: ‘226’, ‘Connection’: ‘close’}
body=

400 Request Header Or Cookie Too Large

400 Bad Request


Request Header Or Cookie Too Large

nginx

how ever this is this cookie are used all time

In the report error I observed

File "/usr/local/lib/python3.10/dist-packages/RequestsLibrary/utils.py", line 154, in decorator
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/RequestsLibrary/RequestsOnSessionKeywords.py", line 33, in get_on_session
    self._check_status(expected_status, response, msg)
  File "/usr/local/lib/python3.10/dist-packages/RequestsLibrary/SessionKeywords.py", line 570, in _check_status
    resp.raise_for_status()
  File "/usr/local/lib/python3.10/dist-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error:

Hi @astrowalker2013 ,

I waited to see if anyone else had some ideas for you, as I’m not really sure what your issue is, but I’ll try to help.

I’d start by moving Log ${cookiesession} to before Create Session and also add a Log ${headers}, like this:

Log    ${cookiesession}
Log    ${headers}
Create Session    dev1    https://tutututut.com    cookies=${cookiesession}

That will let you see what’s inside those variables.

Next where does Get Header come from? It’s not listed in the SeleniumLibrary documentation

The reason I ask is I’m wondering if it’s getting you the request header(s?) or response header(s?) from the last page you loaded with selenium library?

There can be a lot of unnecessary response headers that you don’t need to send as request headers, and even sometimes they change name from request to response (depends on Application) so I’m suspecting the problem is in here, but it might also be in the cookies.

Also the keyword name being Get Header not Get Headers implies it only gets a single header, but which one? you didn’t specify any, did it get any? (see earlier comments about Log ${headers})

Hopefully this helps lead to your answer,

Dave.