Skip to content

Commit

Permalink
http headers: use and adjust vnd.inveniordm.v1+json http accept header
Browse files Browse the repository at this point in the history
  • Loading branch information
anikachurilova committed Feb 2, 2024
1 parent de9dd60 commit 7db8a6b
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 30 deletions.
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 @@ export class RecordsList extends Component {
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 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

0 comments on commit 7db8a6b

Please sign in to comment.