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

should send request with ACCEPT headers when load xml from remote #115

Open
khiav223577 opened this issue Jul 26, 2023 · 0 comments
Open

Comments

@khiav223577
Copy link

In rails server, when a request has no ACCEPT field in the HEADER, it will regard it as html format (ref)

Since we are going to load the xml from remote, it would be better if we can setup the correct headers for server to determine which format should be responded.

Related code

def load_from_remote
request.url = document
response = HTTPI.get(request, adapter)
raise HTTPError.new("Error: #{response.code} for url #{request.url}", response) if response.error?
response.body
end

Possible code to setup the header

request.headers['ACCEPT'] = 'application/xml'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant