Welcome Guest, Not a member yet? Register   Sign In
Set headers on a request from a feature Test
#1

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?
Reply
#2

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;

class
{
    $response service('response');

    $response->setHeader('Content-type''text/html');

    // Sends the output to the browser
    // This is typically handled by the framework
    $response->send();


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 )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB