When calling an automation operation, functions header() and headers() don't work, the passed HTTP header(s) are just ignore when the HTTP request is sent.
The only way to provide HTTP header(s) is to pass it to the execute() function.
See the attached javascript script to execute with the following command to see a demonstration of the issue (create the workspace /default-domain/workspaces/ws1 first):
NODE_DEBUG=http node NXP_async.js
You can see in the generated logs that the HTTP header nx-es-sync is sent only when passed to the execute() function.