File tree Expand file tree Collapse file tree 4 files changed +231
-255
lines changed
Expand file tree Collapse file tree 4 files changed +231
-255
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## 2.5.5
4+
5+ * Hydra: use ` fetchJsonLd ` when expanding an error (to use authorization header)
6+
37## 2.5.4
48
59* Fix sent ` FormData ` when a value is an object or an array (use JSON)
Original file line number Diff line number Diff line change 2525 "enzyme" : " ^3.10.0" ,
2626 "enzyme-adapter-react-16" : " ^1.14.0" ,
2727 "eslint" : " ^7.14.0" ,
28- "eslint-config-prettier" : " ^6.3 .0" ,
28+ "eslint-config-prettier" : " ^7.0 .0" ,
2929 "eslint-plugin-import" : " ^2.14.0" ,
3030 "eslint-plugin-jsx-a11y" : " ^6.1.2" ,
3131 "eslint-plugin-markdown" : " ^1.0.1" ,
6363 ]
6464 },
6565 "dependencies" : {
66- "@api-platform/api-doc-parser" : " ^0.11 .0" ,
66+ "@api-platform/api-doc-parser" : " ^0.12 .0" ,
6767 "history" : " ^4.7.2" ,
68- "jsonld" : " ^1 .2.1 " ,
68+ "jsonld" : " ^3 .2.0 " ,
6969 "lodash.isplainobject" : " ^4.0.6" ,
7070 "prop-types" : " ^15.6.2" ,
7171 "react-admin" : " ^3.0.0"
Original file line number Diff line number Diff line change 33 fetchJsonLd ,
44 getDocumentationUrlFromHeaders ,
55} from '@api-platform/api-doc-parser' ;
6- import { promises } from 'jsonld' ;
6+ import jsonld from 'jsonld' ;
77
88/**
99 * Sends HTTP requests to a Hydra API.
@@ -23,19 +23,19 @@ export default (url, options = {}) => {
2323 requestHeaders . set ( 'Authorization' , options . user . token ) ;
2424 }
2525
26- return fetchJsonLd ( url , {
27- ...options ,
28- headers : requestHeaders ,
29- } ) . then ( ( data ) => {
26+ const authOptions = { ...options , headers : requestHeaders } ;
27+
28+ return fetchJsonLd ( url , authOptions ) . then ( ( data ) => {
3029 const status = data . response . status ;
3130
3231 if ( status < 200 || status >= 300 ) {
3332 const body = data . body ;
3433 delete body . trace ;
3534
36- return promises
35+ return jsonld
3736 . expand ( body , {
3837 base : getDocumentationUrlFromHeaders ( data . response . headers ) ,
38+ documentLoader : ( input ) => fetchJsonLd ( input , authOptions ) ,
3939 } )
4040 . then ( ( json ) => {
4141 return Promise . reject (
You can’t perform that action at this time.
0 commit comments