Package io.karatelabs.core
Class KarateConfig
java.lang.Object
io.karatelabs.core.KarateConfig
- All Implemented Interfaces:
io.karatelabs.js.ObjectLike,io.karatelabs.js.SimpleObject
Holds runtime configuration settings set via the 'configure' keyword.
This is distinct from:
KaratePom- Project file (karate-pom.json) for CLI options- karate-config.js - Runtime bootstrap that runs per-scenario
Example usage:
* configure ssl = true * configure proxy = 'http://proxy:8080' * configure readTimeout = 60000 * def cfg = karate.config * match cfg.sslEnabled == true
Implements SimpleObject so it can be accessed as a JavaScript object
via karate.config.
-
Field Summary
Fields inherited from interface io.karatelabs.js.SimpleObject
TO_STRING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanApply configuration from a key-value pair.copy()Create a deep copy of this configuration.voidcopyFrom(KarateConfig other) Copy all configuration values from another KarateConfig.getAuth()intstatic StringgetChannelFactoryClass(String type) getChannelOptions(String type) intgetProxy()intgetRetry()intintgetSsl()getUrl()booleanbooleanstatic booleanisChannelType(String type) booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanjsKeys()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.karatelabs.js.ObjectLike
getPrototypeMethods inherited from interface io.karatelabs.js.SimpleObject
getMember, jsToString, putMember, removeMember, toMap
-
Constructor Details
-
KarateConfig
public KarateConfig()
-
-
Method Details
-
copy
Create a deep copy of this configuration. Used to snapshot config state for callonce/callSingle isolation.- Returns:
- a new KarateConfig with copied values
-
copyFrom
Copy all configuration values from another KarateConfig. Used to propagate config changes from called features back to the caller.- Parameters:
other- the source config to copy from
-
configure
Apply configuration from a key-value pair.- Parameters:
key- the configure key (e.g., "ssl", "proxy", "readTimeout")value- the value to set- Returns:
- true if HTTP client needs to be rebuilt, false otherwise
- Throws:
RuntimeException- if key is not recognized
-
jsKeys
- Specified by:
jsKeysin interfaceio.karatelabs.js.SimpleObject
-
jsGet
- Specified by:
jsGetin interfaceio.karatelabs.js.SimpleObject
-
getUrl
-
getReadTimeout
public int getReadTimeout() -
getConnectTimeout
public int getConnectTimeout() -
isFollowRedirects
public boolean isFollowRedirects() -
getLocalAddress
-
getCharset
-
getSsl
-
isSslEnabled
public boolean isSslEnabled() -
getSslAlgorithm
-
getSslKeyStore
-
getSslKeyStorePassword
-
getSslKeyStoreType
-
getSslTrustStore
-
getSslTrustStorePassword
-
getSslTrustStoreType
-
isSslTrustAll
public boolean isSslTrustAll() -
getProxy
-
getProxyUri
-
getProxyUsername
-
getProxyPassword
-
getNonProxyHosts
-
getNtlmAuth
-
getNtlmUsername
-
getNtlmPassword
-
getNtlmDomain
-
getNtlmWorkstation
-
getAuth
-
getAuthType
-
getAuthUsername
-
getAuthPassword
-
getAuthToken
-
getAuthAccessTokenUrl
-
getAuthClientId
-
getAuthClientSecret
-
getAuthScope
-
getRetry
-
getRetryInterval
public int getRetryInterval() -
getRetryCount
public int getRetryCount() -
getReport
-
isShowLog
public boolean isShowLog() -
isShowAllSteps
public boolean isShowAllSteps() -
getCallSingleCache
-
getCallSingleCacheMinutes
public int getCallSingleCacheMinutes() -
getCallSingleCacheDir
-
getHeaders
-
getCookies
-
isHttpRetryEnabled
public boolean isHttpRetryEnabled() -
isContinueOnStepFailure
public boolean isContinueOnStepFailure() -
isAbortedStepsShouldPass
public boolean isAbortedStepsShouldPass() -
isAbortSuiteOnFailure
public boolean isAbortSuiteOnFailure() -
isMatchEachEmptyAllowed
public boolean isMatchEachEmptyAllowed() -
isCorsEnabled
public boolean isCorsEnabled() -
getResponseHeaders
-
getBeforeScenario
-
getAfterScenario
-
getAfterScenarioOutline
-
getAfterFeature
-
getDriverConfig
-
getChannelOptions
-
getChannelFactoryClass
-
isChannelType
-