added header support, suppressed println

This commit is contained in:
Tony Tam 2013-09-18 11:55:45 -07:00
parent 0ffc6cb7a0
commit cc0a30edf8
2 changed files with 14 additions and 4 deletions

View File

@ -18,6 +18,7 @@ package com.wordnik.swagger.codegen.spec
import com.wordnik.swagger.codegen.util.{CoreUtils, ApiExtractor, ResourceExtractor}
import com.wordnik.swagger.codegen.PathUtil
import com.wordnik.swagger.model._
import scala.collection.JavaConversions._
@ -28,9 +29,19 @@ object Validator extends PathUtil {
}
val host = args(0)
val authorization = {
// if (args.length > 1) Some("?api_key=" + args(1))
// else
None
Option (System.getProperty("header")) match {
case Some(e) => {
// this is ugly and will be replaced with proper arg parsing like in ScalaAsyncClientGenerator soon
val authInfo = e.split(":")
Some(ApiKeyValue(authInfo(0), "header", authInfo(1)))
}
case _ => {
if (args.length > 1) {
Some(ApiKeyValue("api_key", "query", args(1)))
}
else None
}
}
}
val outputFilename = {

View File

@ -27,7 +27,6 @@ trait RemoteUrl {
}
case None => new URL(url).openConnection()
}
println(conn)
is = conn.getInputStream()
Source.fromInputStream(is).mkString
}