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

Adding header: 'Accept-Language" #6334

Closed
AdaWMPL opened this issue Jan 30, 2024 · 2 comments · Fixed by #6343
Closed

Adding header: 'Accept-Language" #6334

AdaWMPL opened this issue Jan 30, 2024 · 2 comments · Fixed by #6343
Assignees
Labels
fetch urls About fetching URLs in a project Type: Feature Request Identifies requests for new features or enhancements. These involve proposing new improvements.
Milestone

Comments

@AdaWMPL
Copy link

AdaWMPL commented Jan 30, 2024

I must add header: "Accept-Language: en" while I'm adding a column by fetching URLs. Normally, my GREL code looks like this: "https://api-zbiory.mnk.pl/api/object/"+value, but to get data in English I must add this header...
I know that I can use Python instead of GREL to create a request with this header, but it isn't simple and create some problems with code, many errors and stress.

Proposed solution

Add header "Accept-Language" to the list of available headings in window: "Add column by fetching URLs based on column ..."

Alternatives considered

Additional context

@AdaWMPL AdaWMPL added Status: Pending Review Indicates that the issue or pull request is awaiting review by project maintainers or collaborators Type: Feature Request Identifies requests for new features or enhancements. These involve proposing new improvements. labels Jan 30, 2024
@ostephens
Copy link
Sponsor Member

The simple solution is to add this http header to the existing list at

static {
registerHttpHeader("User-Agent", RefineServlet.FULLNAME);
registerHttpHeader("Accept", "*/*");
registerHttpHeader("Authorization", "");
}

However, it would be nicer to enable user-defined headers instead of the current static list so users can add headers as required. I'm not sure of the best approach but wonder if it might make sense to have a setting for supported headers that the user can add to? The way it's currently designed means that extensions can register additional headers as needed which was a deliberate design choice and I think would be good to maintain that option

tfmorris added a commit to tfmorris/OpenRefine that referenced this issue Feb 2, 2024
Add support for Accept-Language, Accept-Charset, Accept-Encoding
and If-Modified-Since.

Also switch to using constants instead of free form strings.
@tfmorris tfmorris self-assigned this Feb 2, 2024
@tfmorris
Copy link
Member

tfmorris commented Feb 2, 2024

Since adding the rest of the Accept-* headers is easy, why don't we start with that?

@tfmorris tfmorris added fetch urls About fetching URLs in a project and removed Status: Pending Review Indicates that the issue or pull request is awaiting review by project maintainers or collaborators labels Feb 2, 2024
@tfmorris tfmorris added this to the 3.8 milestone Feb 2, 2024
tfmorris added a commit that referenced this issue Feb 20, 2024
Add support for Accept-Language, Accept-Charset, Accept-Encoding
and If-Modified-Since.

Also switch to using constants instead of free form strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fetch urls About fetching URLs in a project Type: Feature Request Identifies requests for new features or enhancements. These involve proposing new improvements.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants