• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Set headers on a request from a feature Test

Hi, I am creating an API with code igniter with TDD. However when I came to the authentication I got a problem: I would like to authenticate with bearer token in the headers but I found not way to change headers from test requests to include the token.

Is there anyway to do that?

CodeIgniter also provides a Response class that is an object-oriented representation of the HTTP response.
This gives you an easy and powerful way to construct your response to the client:

PHP Code:
use CodeIgniter\HTTP\Response;

    $response service('response');


    // Sends the output to the browser
    // This is typically handled by the framework

CodeIgniter 4 User Guide - Working With HTTP Requests
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.