When you trigger the inject node it will send one message to the Function node and one to the Request node.
As you want the Function node to set msg.headers before the message is passed to the Request node, delete the wires connecting the Inject and Request nodes.