php

package
v0.0.0-...-ca8de47 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MoveTokenToHeaderForRequests

func MoveTokenToHeaderForRequests(next http.Handler) http.Handler

MoveTokenToHeaderForRequests handles the case where someone sends a JSON body as form values to the request api (at /request). It extracts a '_token' JSON field and puts it into the X-CSRF-Token header instead.

This is needed because our old android app uses this to communicate with the request api, this was apparently a laravel feature where Form.Get (Input::get) style API also read the request body if it was JSON.

Types

type API

type API struct {
	config.Config

	StatusValue *util.Value[radio.Status]
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(ctx context.Context, cfg config.Config, storage radio.StorageService,
	streamer radio.StreamerService, statusValue *util.Value[radio.Status]) (*API, error)

func (*API) RequestRoute

func (a *API) RequestRoute(r chi.Router)

RequestRoute is the router setup for handling requests

func (*API) Route

func (a *API) Route(r chi.Router)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL