File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ import type { Response } from 'cross-fetch';
8
8
9
9
const SPECIAL_FUNCTION_REGEX : RegExp = / [ ' " ] _ _ B E G I N F U N C T I O N _ _ ( .* ?) _ _ E N D F U N C T I O N _ _ [ ' " ] / g;
10
10
11
+ const USER_AGENT = `quickchart-js/3.1.0` ;
12
+
11
13
interface PostData {
12
14
chart : string ;
13
15
width ?: number ;
@@ -40,7 +42,10 @@ function doStringify(chartConfig: ChartConfiguration): string | undefined {
40
42
function postJson ( url : string , payload : PostData ) : Promise < Response > {
41
43
return fetch ( url , {
42
44
method : 'POST' ,
43
- headers : { 'Content-Type' : 'application/json' } ,
45
+ headers : {
46
+ 'User-Agent' : USER_AGENT ,
47
+ 'Content-Type' : 'application/json' ,
48
+ } ,
44
49
body : JSON . stringify ( payload ) ,
45
50
} ) ;
46
51
}
@@ -139,6 +144,7 @@ class QuickChart {
139
144
ret . searchParams . append ( 'c' , this . chart ! ) ;
140
145
ret . searchParams . append ( 'w' , String ( this . width ) ) ;
141
146
ret . searchParams . append ( 'h' , String ( this . height ) ) ;
147
+ ret . searchParams . append ( 'ref' , 'qc-js' ) ;
142
148
if ( this . devicePixelRatio !== 1.0 ) {
143
149
ret . searchParams . append ( 'devicePixelRatio' , String ( this . devicePixelRatio ) ) ;
144
150
}
You can’t perform that action at this time.
0 commit comments