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

Speaker Featuring - Round 1

Speaker Featuring - Round 1

Every conference is more than the talks we see on stage it’s also the story of the people who make it possible.

With the first round of Into the Box 2026 sessions and workshops now live, we’re excited to introduce some of the speakers who will be joining us this year. These community members, practitioners, and Ortus team experts bring decades of real-world experience across CFML, BoxLang, JVM modernization, testing, AI, and cloud-native development.

Victor Campos
Victor Campos
January 26, 2026
First Round of the Into the Box 2026 Agenda Is Live

First Round of the Into the Box 2026 Agenda Is Live

Into the Box 2026 marks an important moment for the CFML and BoxLang community not just because of what’s on the agenda, but because of what it represents: 20 years of Ortus Solutions helping teams move forward, modernize, and build with confidence.

Victor Campos
Victor Campos
January 21, 2026
BoxLang AI v2: Enterprise AI Development Without the Complexity

BoxLang AI v2: Enterprise AI Development Without the Complexity

One Year. 100+ Features. Unlimited Possibilities.

Just one year ago, in March 2024, we launched BoxLang AI 1.0. Today, we're thrilled to announce BoxLang AI v2—a massive leap forward that positions BoxLang as the most powerful and versatile AI framework on the JVM.

Luis Majano
Luis Majano
January 19, 2026