How can I set http headers in Ionic 6, using React?

Viewed 16

I am using Ionic 6 with React, how can I set my http headers?

I tried doing it in the useIonViewWillEnter hook, did not work:

...
import { IonPage, useIonViewWillEnter } from "@ionic/react"
import { HTTP } from "@awesome-cordova-plugins/http"

....
const MyStuff: React.FC = () => {
  useIonViewWillEnter(() => {
    HTTP.setHeader(
      "*",
      "Content-Security-Policy",
      "frame-ancestors 'self' example.com"
    )
  })
0 Answers
Related