我需要根据请求中收到的Cookie向axios请求添加标头。
Value_Away
如上例所示,当我使用Cookie using UnityEngine;
using System.Collections;
public class PlayerControl : MonoBehaviour
{
// Use this for initialization
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
Rigidbody.velocity = movement;
}
}
发出请求时,我希望app.get('/', async (req, res) => {
try {
await axios.get('http://localhost:3000/test');
return res.status(200).send();
} catch (error) {
return res.status(200).send();
}
});
app.get('/test', (req,res) => {
console.log(req.headers['added-header']) // req.headers['added-header'] == 1 or whatever
return res.status(200).send();
}
请求拥有addHeader=true;
标头。我已经尝试过在中间件中使用Proxing函数调用并使用拦截器。