Sample code for 30+ languages & platforms
Dart

Inspect HTTP Request Header

Demonstrates the LastHeader property.

Chilkat Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

void main() {
  final http = CkHttp();

  final url = 'https://chilkatsoft.com/echo_request_body.asp';
  final json = '{"greeting":"Hello World"}';

  // Send a POST with the JSON in the HTTP request body.
  final resp = CkHttpResponse();
  try {
    http.httpStr('POST', url, json, 'utf-8', 'application/json', resp);
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  // Examine the HTTP request header we just sent.
  print(http.lastHeader);

  // Output:

  // POST /echo_request_body.asp HTTP/1.1
  // Host: chilkatsoft.com
  // Accept: */*
  // Accept-Encoding: gzip
  // Content-Type: application/json
  // Content-Length: 26
}