OPTIONS HTTP requests not supported

Why are OPTIONS HTTP requests not supported? They are often required for dynamic sync tables.

Is there a way to enable them?

Hi @Tobias_Feistmantl - I’m not sure if that was an oversight or if there was a reason it was omitted. It hasn’t come up before though, and isn’t a very common HTTP method for most APIs. Can you share more about a specific API endpoint you need to use it with?

Hi Eric,

the WordPress REST API for example.

It gives context about the resources.

I’d need it there to generate dynamic sync tables.

@Eric_Koleda sorry, I didn’t tag you correctly! :slightly_smiling_face:

Not your fault, I’m just behind on my email :slight_smile:

I’ll file a feature request to support OPTIONS, but from what I know adding support for a new HTTP method requires changes to many layers of our stack, so it may not be something we tackle right away.

In the mean time you should be able to use the X-HTTP-Method-Override header to send a GET request but have it treated as an OPTIONS request.

let response = await context.fetcher.fetch({
  method: "GET",
  url: url,
  headers: {
    "X-HTTP-Method-Override": "OPTIONS",
  },
});

Not every API supports this header, but it appears that the Wordress API does.

1 Like