Home Manual Reference Source
import HttpDjangoJsonRequest from 'ievv_jsbase/lib/http/HttpDjangoJsonRequest'
public class | source

HttpDjangoJsonRequest

Extends:

source/http/HttpJsonRequest.js~HttpJsonRequest → HttpDjangoJsonRequest

Extends HttpJsonRequest with automatic handling of the Django csrftoken.

Example:

Make a POST request
const request = new HttpDjangoJsonRequest('http://example.com/api/users/');
request.post({'name': 'Peter Pan', 'age': 14})
    .then((response) => {
        console.log('Success!', response.bodydata);
    })
    .catch((error) => {
        console.error('Error:', error.toString());
    });

Constructor Summary

Public Constructor
public

constructor(args: *)

Member Summary

Public Members
public get

Returns the value of the csrftoken cookie.

Method Summary

Public Methods
public

Ensures the csrftoken cookie value is automatically set in the X-CSRFToken header for all requests except GET and HEAD.

Public Constructors

public constructor(args: *) source

Params:

NameTypeAttributeDescription
args *

Same args as for HttpResponse.

Public Members

public get csrftoken: * source

Returns the value of the csrftoken cookie.

Public Methods

public setDefaultRequestHeaders(method: *) source

Ensures the csrftoken cookie value is automatically set in the X-CSRFToken header for all requests except GET and HEAD.

Params:

NameTypeAttributeDescription
method *

See HttpRequest.