Welcome Guest, Not a member yet? Register   Sign In
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 )

Theme © iAndrew 2016 - Forum software by © MyBB