You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m encountering a CORS error when attempting to access the text of a bill from a flutter application running as a web app on Chrome. Specifically, accessing the api.congress.gov/bill/{congress}/{billType}/{billNumber}/text endpoint works, however when I try to access the URL in the formats property of the response such as https://www.congress.gov/117/bills/hr3076/BILLS-117hr3076enr.pdf to retrieve the text of the bill it is blocked by CORS policy.
Here's how to reproduce the issue in dart using my example URL: http.get(Uri.parse('https://congress.gov/118/bills/hr815/BILLS-118hr815enr.htm'));
Here’s the error message from the browser console: Access to XMLHttpRequest at 'https://congress.gov/118/bills/hr815/BILLS-118hr815enr.htm' from origin 'http://localhost:38581' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I've noticed that this error happens only when trying to access URLs that start with congress.gov instead of api.congress.gov, such as when getting the PDF for a daily congressional record, for instance https://www.congress.gov/118/crec/2024/11/20/170/172/CREC-2024-11-20.pdf
This issue limits the use of the Congress API for web applications. It would be great if this could be resolved so web platforms can have more functionality with the API.
Thank you!
The text was updated successfully, but these errors were encountered:
Hello,
I’m encountering a CORS error when attempting to access the text of a bill from a flutter application running as a web app on Chrome. Specifically, accessing the
api.congress.gov/bill/{congress}/{billType}/{billNumber}/text
endpoint works, however when I try to access the URL in the formats property of the response such ashttps://www.congress.gov/117/bills/hr3076/BILLS-117hr3076enr.pdf
to retrieve the text of the bill it is blocked by CORS policy.Here's how to reproduce the issue in dart using my example URL:
http.get(Uri.parse('https://congress.gov/118/bills/hr815/BILLS-118hr815enr.htm'));
Here’s the error message from the browser console:
Access to XMLHttpRequest at 'https://congress.gov/118/bills/hr815/BILLS-118hr815enr.htm' from origin 'http://localhost:38581' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I've noticed that this error happens only when trying to access URLs that start with
congress.gov
instead ofapi.congress.gov
, such as when getting the PDF for a daily congressional record, for instancehttps://www.congress.gov/118/crec/2024/11/20/170/172/CREC-2024-11-20.pdf
This issue limits the use of the Congress API for web applications. It would be great if this could be resolved so web platforms can have more functionality with the API.
Thank you!
The text was updated successfully, but these errors were encountered: