@@ -55,6 +55,10 @@ export default class RunestoneBase {
5555 this . question_label = $ ( opts . orig ) . data ( "question_label" ) ;
5656 }
5757 }
58+ this . jsonHeaders = new Headers ( {
59+ "Content-type" : "application/json; charset=utf-8" ,
60+ Accept : "application/json" ,
61+ } ) ;
5862 }
5963
6064 async logBookEvent ( eventInfo ) {
@@ -69,13 +73,9 @@ export default class RunestoneBase {
6973 eventInfo . percent = this . percent ;
7074 }
7175 if ( eBookConfig . useRunestoneServices && eBookConfig . logLevel > 0 ) {
72- let headers = new Headers ( {
73- "Content-type" : "application/json; charset=utf-8" ,
74- Accept : "application/json" ,
75- } ) ;
7676 let request = new Request ( eBookConfig . ajaxURL + "hsblog" , {
7777 method : "POST" ,
78- headers : headers ,
78+ headers : this . jsonHeaders ,
7979 body : JSON . stringify ( eventInfo ) ,
8080 } ) ;
8181 post_return = await fetch ( request ) ;
@@ -105,13 +105,9 @@ export default class RunestoneBase {
105105 eventInfo . save_code = "True" ;
106106 }
107107 if ( eBookConfig . useRunestoneServices && eBookConfig . logLevel > 0 ) {
108- let headers = new Headers ( {
109- "Content-type" : "application/json; charset=utf-8" ,
110- Accept : "application/json" ,
111- } ) ;
112108 let request = new Request ( eBookConfig . ajaxURL + "runlog.json" , {
113109 method : "POST" ,
114- headers : headers ,
110+ headers : this . jsonHeaders ,
115111 body : JSON . stringify ( eventInfo ) ,
116112 } ) ;
117113 post_promise = await fetch ( request ) ;
0 commit comments