title: How to add custom headers in Playwright
body: <pre><code>headers[&quot;user-agent&quot;] = fakeUa();
    console.log(fakeUa())
    let firstReq = true;
      page.route('**/*', route =&gt; {
      const request = route.request()
      //console.log(request.url(), JSON.stringify(request.headers()));
      
      if(&quot;x-j3popqvx-a&quot; in request.headers()){
          headers = request.headers();
          //console.log(headers);
          console.log(&quot;exiting&quot;);
          return;
      }
      else {
          console.log(&quot;in&quot;);
          return route.continue({headers: headers});
      }
    });
    let pageRes = await page.goto(url, {waitUntil: 'load', timeout: 0});
  </code></pre>
  <p>I want to add fake user agent when sending request to url. But it doesn't add the fake useragent rather goes with the default one.</p>