REST Switch not sending correct method

I’m trying to configure a REST Switch but for some anoying reason it seems to be sending a GET request even with the method set to PUT then I’m receiving this error:

2023-07-13 11:18:22.293 DEBUG (MainThread) [httpcore.http11] receive_response_body.started request=<Request [b'GET']>
2023-07-13 11:18:22.294 DEBUG (MainThread) [httpcore.http11] receive_response_body.complete
2023-07-13 11:18:22.295 DEBUG (MainThread) [httpcore.http11] response_closed.started
2023-07-13 11:18:22.296 DEBUG (MainThread) [httpcore.http11] response_closed.complete
2023-07-13 11:18:22.299 ERROR (MainThread) [homeassistant.components.rest.switch] Got non-ok response from resource: 405

The configuration is:

switch:
  - platform: rest
    name: 'iHostTeste'
    resource: 'http://192.168.0.9/open-api/v1/rest/devices/87h43h2889'
    method: 'PUT'
    body_on: '{ "state": { "power": { "powerState": "on" } } }'
    body_off: '{ "state": { "power": { "powerState": "off" } } }'
    headers:
      Content-Type: application/json
      Authorization: 'Bearer h43jh34j-sssa-321312-dds-123bbddd4322'
    verify_ssl: false

What could be happening?

Docs say:

method string (optional, default: post)
The method of the request. Supported post, put or patch.

Try method: 'put' as a first step.

Already tried, as it seems HA is trying to GET status before creating the switch and initialize, but the method I’m consuming does not respond to get and it’s generating an exception.

By default, the rest platform does a GET on the resource url to get the state of the switch.
I guess you have to play with is_on_template and state_resource

Yes, I perceived… In fact I had to create a Node Red custom responde to make it work. It’s a little strange…
Is shound’t be like this, but that’s what we have for today…
Thanks!