Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POST requests not properly handled #227

Open
liberaliscomputing opened this issue Mar 28, 2019 · 0 comments
Open

POST requests not properly handled #227

liberaliscomputing opened this issue Mar 28, 2019 · 0 comments

Comments

@liberaliscomputing
Copy link

liberaliscomputing commented Mar 28, 2019

I have a collection of CSS code to be validated and was sending GET requests with url encoded code as a text query parameter. For a large fraction of them, it was successful, but sometimes validation threw an error since the text was too long to be handled by GET. So, I've tried to send POST requests with the following variables in Python:

import requests

URL = 'http://localhost:8080/css-validator/validator'
HEADERS = {'Content-Type': 'text/css; charset=utf-8'}
PARAMS = {
  'output': 'json',
  'warning': 2,
  'profile': 'css3svg'
}
code = 'STRING_OF_CSS_CODE'

resp = requests.post(URL, headers=HEADERS, params=PARAMS, data=code)
print(resp.content) # resp.json() returns a parsing error

, which returned HTML outputs even though json was given. Parsing HTMLs itself is not a problem, but having an HTML output against the json parameter given seems like an unexpected result for the users. Or, if the way I've tried with is incorrect in sending a POST request and there is some documentation about it, that would be very informational.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant