#!/usr/bin/env ruby

require 'sinatra'
require 'json'

require_relative 'left-pad'

get '/' do
    str = params['str'] || ""
    ch  = params['ch']  || ""
    len = params['len'] || 0

    { str: LeftPad.leftPad(str, len, ch) }.to_json
end

#!/usr/bin/env ruby

require 'sinatra'
require 'json'

require_relative 'left-pad'

get '/' do
    str = params['str'] || ""
    ch  = params['ch']
    len = params['len']

    { str: LeftPad.leftPad(str, len, ch) }.to_json
end

--- 
+++ 
@@ -7,8 +7,8 @@
 
 get '/' do
     str = params['str'] || ""
-    ch  = params['ch']
-    len = params['len']
+    ch  = params['ch']  || ""
+    len = params['len'] || 0
 
     { str: LeftPad.leftPad(str, len, ch) }.to_json
 end
Add some null variable checks
