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

http headers: use and adjust vnd.inveniordm.v1+json http accept header #2565

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions invenio_app_rdm/records_ui/searchapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def search_app_context():
config_name="RDM_SEARCH_USER_REQUESTS",
available_facets=current_app.config["REQUESTS_FACETS"],
sort_options=current_app.config["RDM_SORT_OPTIONS"],
headers={"Accept": "application/json"},
headers={"Accept": "application/vnd.inveniordm.v1+json"},
hidden_params=[
["expand", "1"],
["is_open", "true"],
Expand Down Expand Up @@ -65,6 +65,6 @@ def search_app_context():
config_name="RDM_SEARCH",
available_facets=current_app.config["RDM_FACETS"],
sort_options=current_app.config["RDM_SORT_OPTIONS"],
headers={"Accept": "application/json"},
headers={"Accept": "application/vnd.inveniordm.v1+json"},
),
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,8 @@ export default class RemovalReasonsSelect extends Component {
const { setFieldValue } = this.props;
this.setState({ loading: true });
const url = "/api/vocabularies/removalreasons";
this.cancellableAction = withCancel(
http.get(url, {
headers: {
Accept: "application/vnd.inveniordm.v1+json",
},
})
);
this.cancellableAction = withCancel(http.get(url));

try {
const response = await this.cancellableAction.promise;
const options = response.data.hits.hits;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,7 @@
const { fetchUrl } = this.props;
this.setState({ isLoading: true });

this.cancellableFetch = withCancel(
http.get(fetchUrl, {
headers: {
Accept: "application/vnd.inveniordm.v1+json",
},
})
);
this.cancellableFetch = withCancel(http.get(fetchUrl));

try {
const response = await this.cancellableFetch.promise;
Expand All @@ -69,7 +63,7 @@
<Container>
<Header as="h2">{title}</Header>
{Array.from(Array(10)).map((item, index) => (
<div key={index}>

Check warning on line 66 in invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/frontpage/RecordsList.js

View workflow job for this annotation

GitHub Actions / Tests (3.8, pypi, postgresql13, opensearch2, 14.x)

Do not use Array index in keys

Check warning on line 66 in invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/frontpage/RecordsList.js

View workflow job for this annotation

GitHub Actions / Tests (3.8, pypi, postgresql13, elasticsearch7, 14.x)

Do not use Array index in keys

Check warning on line 66 in invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/frontpage/RecordsList.js

View workflow job for this annotation

GitHub Actions / Tests (3.9, pypi, postgresql13, opensearch2, 14.x)

Do not use Array index in keys

Check warning on line 66 in invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/frontpage/RecordsList.js

View workflow job for this annotation

GitHub Actions / Tests (3.9, pypi, postgresql13, elasticsearch7, 14.x)

Do not use Array index in keys
<Placeholder fluid className="rel-mt-3">
<Placeholder.Header>
<Placeholder.Line />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ export class CommunitiesManagement extends Component {

fetchRecordCommunities = async () => {
const { recordCommunityEndpoint } = this.props;
return await http.get(recordCommunityEndpoint, {
headers: {
Accept: "application/vnd.inveniordm.v1+json",
},
});
return await http.get(recordCommunityEndpoint);
};

getCommunities = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const EditButton = ({ recid, onError }) => {
{
headers: {
"Content-Type": "application/json",
"Accept": "application/vnd.inveniordm.v1+json",
},
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,7 @@ export const RecordVersionsList = ({ record, isPreview }) => {
const fetchVersions = async () => {
return await http.get(
`${recordDeserialized.links.versions}?size=${NUMBER_OF_VERSIONS}&sort=version&allversions=true`,
{
headers: {
Accept: "application/vnd.inveniordm.v1+json",
},
withCredentials: true,
}
{ withCredentials: true }
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export const RDMRecordResultsListItem = ({ result }) => {
{
headers: {
"Content-Type": "application/json",
"Accept": "application/vnd.inveniordm.v1+json",
},
}
)
Expand Down
2 changes: 1 addition & 1 deletion invenio_app_rdm/users_ui/searchapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def search_app_context():
current_app.config["REQUESTS_FACETS"],
current_app.config["RDM_SORT_OPTIONS"],
"/api/user/requests",
{"Accept": "application/json"},
{"Accept": "application/vnd.inveniordm.v1+json"},
initial_filters=[["is_open", "true"]],
hidden_params=[["expand", "1"]],
),
Expand Down
Loading