OAS: handle urlencoded and multipart form data correctly (#730)

* Start with tests

* Expected file

* Almost works

* Make test stab;e

* 5 examples, not 6

* Add param type

* multipart example

* parsing multipart

* Commit

* Commit

* multipart

* Write encoding into schema

* Stable test

* Add reset

* Refactoring

* Refactoring

* Maintain the required flag

* lint
This commit is contained in:
Andrey Pokhilko
2022-02-03 11:46:31 +03:00
committed by GitHub
parent 78be20fe4d
commit 5934be4da6
10 changed files with 833 additions and 88 deletions

View File

@@ -110,13 +110,14 @@ func feedFromHAR(file string, isSync bool) (int, error) {
cnt := 0
for _, entry := range harDoc.Log.Entries {
cnt += 1
feedEntry(&entry, "", isSync)
feedEntry(&entry, "", isSync, file)
}
return cnt, nil
}
func feedEntry(entry *har.Entry, source string, isSync bool) {
func feedEntry(entry *har.Entry, source string, isSync bool, file string) {
entry.Comment = file
if entry.Response.Status == 302 {
logger.Log.Debugf("Dropped traffic entry due to permanent redirect status: %s", entry.StartedDateTime)
}
@@ -176,7 +177,7 @@ func feedFromLDJSON(file string, isSync bool) (int, error) {
logger.Log.Warningf("Failed decoding entry: %s", line)
} else {
cnt += 1
feedEntry(&entry, source, isSync)
feedEntry(&entry, source, isSync, file)
}
}
}