File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
src/frontend/components/ProductCard Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ the release.
20
20
([ #1727 ] ( https://github.com/open-telemetry/opentelemetry-demo/pull/1727 ) )
21
21
* [ chore] Fix binding for host's volume mount
22
22
([ #1728 ] ( https://github.com/open-telemetry/opentelemetry-demo/pull/1728 ) )
23
+ * [ frontend] fix imageSlowLoad headers not applied
24
+ to 1.8.0 together with other dependencies
25
+ ([ #1733 ] ( https://github.com/open-telemetry/opentelemetry-demo/pull/1733 ) )
23
26
24
27
## 1.11.1
25
28
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ interface IProps {
12
12
product : Product ;
13
13
}
14
14
15
- async function getImageWithHeaders ( url : RequestInfo , headers : Record < string , string > ) {
16
- const res = await fetch ( url , { headers } ) ;
15
+ async function getImageWithHeaders ( requestInfo : Request ) {
16
+ const res = await fetch ( requestInfo ) ;
17
17
return await res . blob ( ) ;
18
18
}
19
19
@@ -33,9 +33,16 @@ const ProductCard = ({
33
33
const [ imageSrc , setImageSrc ] = useState < string > ( '' ) ;
34
34
35
35
useEffect ( ( ) => {
36
- const requestInfo = new Request ( '/images/products/' + picture ) ;
37
- const headers = { 'x-envoy-fault-delay-request' : imageSlowLoad . toString ( ) , 'Cache-Control' : 'no-cache' } ;
38
- getImageWithHeaders ( requestInfo , headers ) . then ( blob => {
36
+ const headers = new Headers ( ) ;
37
+ headers . append ( 'x-envoy-fault-delay-request' , imageSlowLoad . toString ( ) ) ;
38
+ headers . append ( 'Cache-Control' , 'no-cache' )
39
+ const requestInit = {
40
+ method : "GET" ,
41
+ headers : headers
42
+ } ;
43
+ const image_url = '/images/products/' + picture
44
+ const requestInfo = new Request ( image_url , requestInit ) ;
45
+ getImageWithHeaders ( requestInfo ) . then ( blob => {
39
46
setImageSrc ( URL . createObjectURL ( blob ) ) ;
40
47
} ) ;
41
48
} , [ imageSlowLoad , picture ] ) ;
You can’t perform that action at this time.
0 commit comments