Fetch
The Fetch module allows submitting GET and POST requests to a remote server. The module provides functionality for handling content with different formats(String values, JSON objects, FormData content).
Usage
Get
The example demonstrates different ways, how we could receive content from a server while making HTTP GET request.
Get requests response body as a string value.
Get JSON object response and to access the available data in it.
Get the fetch result as a FormData.
With fetch
we can make a request and check the response status code by accessing status
property.
The example demonstrates, how to get the request-response header and how to access the available data in it.
Post
The example shows how to create POST request while using NativeScript fetch.