CleoMenezesJr / escambo

Escambo is an HTTP-based APIs test application for GNOME
https://flathub.org/apps/io.github.cleomenezesjr.Escambo
GNU General Public License v3.0
140 stars 10 forks source link

Bug: Allow to create header with white space before key breaks application. #52

Closed PabloEmidio closed 1 year ago

PabloEmidio commented 1 year ago

Terminal output:

Exception in thread Thread-1 (__which_method):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/app/share/escambo/escambo/window.py", line 233, in __which_method
    response, status_code, code_type = get_resolve_requests_attr()
  File "/app/share/escambo/escambo/restapi.py", line 46, in resolve_post
    response = self.session.post(
  File "/app/lib/python3.10/site-packages/requests/sessions.py", line 577, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/app/lib/python3.10/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/app/lib/python3.10/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/app/lib/python3.10/site-packages/requests/adapters.py", line 440, in send
    resp = conn.urlopen(
  File "/app/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/app/lib/python3.10/site-packages/urllib3/connectionpool.py", line 398, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/app/lib/python3.10/site-packages/urllib3/connection.py", line 239, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1323, in _send_request
    self.putheader(hdr, value)
  File "/app/lib/python3.10/site-packages/urllib3/connection.py", line 224, in putheader
    _HTTPConnection.putheader(self, header, *values)
  File "/usr/lib/python3.10/http/client.py", line 1250, in putheader
    raise ValueError('Invalid header name %r' % (header,))
ValueError: Invalid header name b' User-Agent'

GUI loading not stop.

image

CleoMenezesJr commented 1 year ago

The issue had already been identified, but needs to be fixed first #41