Laravel: Custom Accept API Header

Assalamualaikum / Hi,

It’s been a while since I stumble upon an API, which have custom Accept header.

For a past few days, I have a chance to implement custom header on one of my client project.

Here is how I did – create a middleware to filter the coming request.

As you can see above, my approach is using a middleware to check out every request come in. You just need to register this middleware in api middleware.

Now you’re ready with your custom Accept header.

You also can use the custom Accept header to have version control of your API.

Thanks! Happy Coding!

Leave a Reply

Your email address will not be published. Required fields are marked *

seventeen + 8 =