Conversation
… данных на клиенте. Если это был GET запрос, то в ответе присылается код ответа и количество вхождений под строчки в строку с результатом от сервера. В остальных случаях просто возвращает ответ от сервера. Также для клиента добавил формочку, которая запрашивает эту строчку, если выбрана кнопка GET запроса
jmbloodycon
reviewed
May 22, 2023
server/server.py
Outdated
| if not HttpServer.validate_body(settings): | ||
| response = HttpServer.create_bad_request_response( | ||
| origin, | ||
| 'Вы не ввели либо url, либо тип запроса' |
There was a problem hiding this comment.
а давай писать чего именно недостает - а то чот ка кто непонятненько
Collaborator
Author
There was a problem hiding this comment.
Переделал. Теперь возвращаются понятные сообщения от валидации
server/server.py
Outdated
| client_data = client.get_data() | ||
|
|
||
| client_data = client.get_data() | ||
| if client_data == 'Неправильный url адрес или port': |
Collaborator
Author
There was a problem hiding this comment.
Добавил все в енамы
server/server.py
Outdated
|
|
||
| response = self.create_response(client_data, origin) | ||
| conn.sendall(response.encode()) | ||
| if settings.get('request').lower() == 'get' and len(settings.get('get_form')) != 0: |
There was a problem hiding this comment.
уверен, что именно так надо сравнивать?)))
server/server.py
Outdated
Comment on lines
+102
to
+107
| if \ | ||
| body.get('url') is None or \ | ||
| body.get('request') is None or \ | ||
| type(body.get('cookie')) != dict or \ | ||
| type(body.get('headers')) != dict or \ | ||
| type(body.get('body')) != str: |
There was a problem hiding this comment.
а давай условие в скобки занесем, и не будем такие переносы делать?
Collaborator
Author
There was a problem hiding this comment.
Сделал несколько отдельных if для этого
server/server.py
Outdated
| if \ | ||
| body.get('url') is None or \ | ||
| body.get('request') is None or \ | ||
| type(body.get('cookie')) != dict or \ |
There was a problem hiding this comment.
а еще типы сравнивают как isinstance а не чеканьем типов от type)))
Collaborator
Author
There was a problem hiding this comment.
Поменял на isinstance
server/server.py
Outdated
| """ | ||
|
|
||
| if \ | ||
| body.get('url') is None or \ |
There was a problem hiding this comment.
Suggested change
| body.get('url') is None or \ | |
| not body.get('url') or |
jmbloodycon
approved these changes
May 29, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.