Blog

Luis Majano

December 09, 2025

Spread the word


Share your thoughts

New in BoxLang 1.8.0 - Say goodbye to verbose HTTP request building. BoxLang introduces a powerful fluent HTTP API that makes working with HTTP/S requests not just easier, but actually enjoyable.

Why This Changes Everything

BoxLang 1.8.0 introduces the http() BIF - a modern, chainable interface that transforms how you build HTTP requests. Gone are the days of juggling multiple configuration steps. Now you write requests the way you think about them:

// Clean, readable, powerful
result = http( "https://api.github.com/repos/ortus-boxlang/boxlang" )
    .header( "Accept", "application/json" )
    .userAgent( "BoxLang-App/1.0" )
    .timeout( 30 )
    .asJSON()  // Auto-parse response!
    .send()

println( result.name )  // Direct access to parsed data

The Power of Fluency

Built-in Response Transformers

Stop manually parsing responses. BoxLang does it for you:

// JSON response? Parse it automatically
userData = http( "https://api.example.com/users/123" )
    .asJSON()
    .send()

// XML? No problem
xmlDoc = http( "https://api.example.com/data.xml" )
    .asXML()
    .send()

// Plain text
content = http( "https://example.com/readme.txt" )
    .asText()
    .send()

Conditional Request Building

Build dynamic requests with elegant conditional logic:

httpClient = http( "https://api.example.com/data" )

// Add auth only if token exists
httpClient.ifNotNull( authToken, ( req ) => {
    req.header( "Authorization", "Bearer " & authToken )
} )

// Admin-specific headers
httpClient.when( userIsAdmin, ( req ) => {
    req.header( "X-Admin-Token", adminToken )
} )

// Default timeout if none specified
httpClient.ifNull( customTimeout, ( req ) => {
    req.timeout( 30 )
} )

result = httpClient.send()

REST Made Ridiculously Simple

HTTP method shortcuts make REST APIs a breeze:

// GET request (default method)
users = http( "https://api.example.com/users" ).send()

// POST with JSON body
newUser = http( "https://api.example.com/users" )
    .post()
    .jsonBody( '{"name":"John","email":"john@example.com"}' )
    .send()

// PUT to update
updated = http( "https://api.example.com/users/123" )
    .put()
    .body( { name: "Jane Doe" } )
    .send()

// DELETE
http( "https://api.example.com/users/123" )
    .delete()
    .send()

Real-Time Streaming with SSE

BoxLang natively supports Server-Sent Events for real-time data. Integrate with AI LLMs natively and easily:

function processEvent( event, lastEventId, httpResult, httpClient, response ) {
    println( "Event: " & event.event )
    println( "Data: " & event.data )
}

// Consume live event stream
http( "https://api.example.com/events" )
    .header( "Accept", "text/event-stream" )
    .onChunk( processEvent )
    .send()

Async by Default

Need non-blocking requests? BoxLang integrates seamlessly with Box Futures (https://boxlang.ortusbooks.com/boxlang-framework/asynchronous-programming):

// Fire and forget
boxFuture = http( "https://api.example.com/data" )
    .sendAsync()

// Process when ready
boxFuture.then( ( result ) => {
    println( "Got data: " & result.fileContent )
} )

Advanced Features That Just Work

Lifecycle Callbacks

Monitor and control the entire request lifecycle:

function handleRequestStart( httpResult, httpClient ) {
    println( "Starting request..." )
}

function handleChunk( chunk, lastEventId, httpResult ) {
    println( "Received: " & chunk.data.len() & " bytes" )
}

function handleComplete( httpResult ) {
    println( "Request completed: " & httpResult.statusCode )
}

function handleError( error, httpResult ) {
    println( "Error occurred: " & error.message )
}

http( "https://api.example.com/large-file" )
    .onRequestStart( handleRequestStart )
    .onChunk( handleChunk )
    .onComplete( handleComplete )
    .onError( handleError )
    .send()

File Uploads Made Simple

Multipart form data has never been easier:

http( "https://api.example.com/upload" )
    .post()
    .multipart()
    .file( "document", "/path/to/file.pdf" )
    .formField( "description", "Important document" )
    .formField( "category", "reports" )
    .send()

Enterprise-Ready Configuration

result = http( "https://api.example.com/data" )
    .connectionTimeout( 30 )
    .httpVersion( "HTTP/2" )
    .redirect( true )
    .proxyServer( "proxy.company.com", 8080 )
    .clientCert( "/path/to/cert.p12", "password" )
    .throwOnError( true )  // Auto-throw on 4xx/5xx
    .send()

The Bottom Line

BoxLang's HTTP API isn't just syntactic sugar - it's a fundamental rethinking of how HTTP requests should work in a modern language. With:

  • 🎯 Intellisense-friendly method names
  • ⚑ Async execution out of the box
  • πŸ“‘ Native SSE support
  • πŸš€ Built-in transformers
  • 🎨 Conditional building
  • πŸ”§ HTTP/2 by default

You get enterprise-grade HTTP capabilities with developer-first ergonomics.

Ready to experience the future of HTTP in the JVM?

Get started with BoxLang today: boxlang.io

Add Your Comment

Recent Entries

ColdBox 8.1.0 Released β€” AI Routing, MCP, and BoxLang-First Power! πŸš€

ColdBox 8.1.0 Released β€” AI Routing, MCP, and BoxLang-First Power! πŸš€

We are thrilled to announce ColdBox 8.1.0, a targeted minor release packed with powerful new features, important improvements, and critical bug fixes across ColdBox, WireBox, and CacheBox. While minor in version number, this release delivers some truly exciting capabilities β€” especially for BoxLang developers building AI-powered applications.

Luis Majano
Luis Majano
April 14, 2026
ColdFusion Modernization for UK Universities Without Downtime

ColdFusion Modernization for UK Universities Without Downtime

Across the United Kingdom, many universities still rely on legacy ColdFusion and CFML systems to power student portals, enrollment platforms, research databases, payment gateways, and internal academic workflows.

These systems are often:

  • 15 to 25 years old
  • Mission-critical
  • Deeply integrated with student information systems
  • Running on older Adobe ColdFusion or Lucee versions
  • Tightly coupled monolithi...

Cristobal Escobar
Cristobal Escobar
April 13, 2026