]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/webapps/fjsc/fjsc.factor
http.server.responses: adding <html-content>, use it.
[factor.git] / extra / webapps / fjsc / fjsc.factor
index 52227ade16be4541abf58f3c4df43a4f1045111e..67e27fc63f974179dfbde90114957e7ec7c324ef 100644 (file)
@@ -33,12 +33,15 @@ TUPLE: fjsc < dispatcher ;
     over "/" head? [ "/" append ] unless 
     swap append  ;
 
+: <javascript-content> ( body -- content )
+    "application/javascript" <content> ;
+
 : do-compile-url ( url -- response )
     [
         absolute-url http-get nip 'expression' parse
         fjsc-compile write "();" write
     ] with-string-writer
-    "application/javascript" <content> ;
+    <javascript-content> ;
 
 : v-local ( string -- string )
     dup "http:" head? [ "Unable to compile code from remote sites" throw ] when ;
@@ -55,10 +58,10 @@ TUPLE: fjsc < dispatcher ;
         [ validate-compile-url "url" value do-compile-url ] >>display ;
 
 : do-compile ( code -- response )
-    [ 
+    [
         'expression' parse fjsc-compile write
     ] with-string-writer
-    "application/javascript" <content> ;
+    <javascript-content> ;
 
 : validate-compile ( -- )
     {