mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
feat: support api layer and global headers for testcase
This commit is contained in:
@@ -16,6 +16,9 @@ type Boomer struct {
|
||||
|
||||
memoryProfile string
|
||||
memoryProfileDuration time.Duration
|
||||
|
||||
disableKeepalive bool
|
||||
disableCompression bool
|
||||
}
|
||||
|
||||
// NewStandaloneBoomer returns a new Boomer, which can run without master.
|
||||
@@ -52,6 +55,24 @@ func (b *Boomer) SetRateLimiter(maxRPS int64, requestIncreaseRate string) {
|
||||
}
|
||||
}
|
||||
|
||||
// SetDisableKeepAlive disable keep-alive for tcp
|
||||
func (b *Boomer) SetDisableKeepAlive(disableKeepalive bool) {
|
||||
b.disableKeepalive = disableKeepalive
|
||||
}
|
||||
|
||||
// SetDisableCompression disable compression to prevent the Transport from requesting compression with an "Accept-Encoding: gzip"
|
||||
func (b *Boomer) SetDisableCompression(disableCompression bool) {
|
||||
b.disableCompression = disableCompression
|
||||
}
|
||||
|
||||
func (b *Boomer) GetDisableKeepAlive() bool {
|
||||
return b.disableKeepalive
|
||||
}
|
||||
|
||||
func (b *Boomer) GetDisableCompression() bool {
|
||||
return b.disableCompression
|
||||
}
|
||||
|
||||
// SetLoopCount set loop count for test.
|
||||
func (b *Boomer) SetLoopCount(loopCount int64) {
|
||||
b.localRunner.loop = &Loop{loopCount: loopCount}
|
||||
|
||||
@@ -255,6 +255,10 @@ func deserializeStatsEntry(stat interface{}) (entryOutput *statsEntryOutput, err
|
||||
var duration float64
|
||||
if entry.Name == "Total" {
|
||||
duration = float64(entry.LastRequestTimestamp - entry.StartTime)
|
||||
// fix: avoid divide by zero
|
||||
if duration < 1 {
|
||||
duration = 1
|
||||
}
|
||||
} else {
|
||||
duration = float64(reportStatsInterval / time.Second)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user