diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6cef8bcbe9..781a5781f6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,17 +5,7 @@ on: [ push, pull_request ] permissions: contents: read -jobs: - lint-pr: - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false - path: mitmproxy - - uses: TrueBrain/actions-flake8@9a43ff1b2c7b96f3edffc48a49973ce3de116ba1 - # mirrored at https://github.com/mitmproxy/mitmproxy/settings/actions +jobs: lint-local: if: github.event_name == 'push' runs-on: ubuntu-latest diff --git a/browserup-proxy.schema.json b/browserup-proxy.schema.json index aa5a9647bb..a1b28316a5 100644 --- a/browserup-proxy.schema.json +++ b/browserup-proxy.schema.json @@ -456,6 +456,143 @@ } } }, + "Har": { + "type": "object", + "required": [ + "log" + ], + "properties": { + "log": { + "type": "object", + "externalDocs": { + "description": "HAR (HTTP Archive) Log Format", + "url": "http://www.softwareishard.com/blog/har-12-spec/" + }, + "required": [ + "version", + "creator", + "entries" + ], + "properties": { + "version": { + "type": "string" + }, + "creator": { + "type": "object", + "required": [ + "name", + "version" + ], + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "comment": { + "type": "string" + } + } + }, + "browser": { + "type": "object", + "required": [ + "name", + "version" + ], + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "comment": { + "type": "string" + } + } + }, + "pages": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Page" + } + }, + "entries": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Entry" + } + }, + "comment": { + "type": "string" + } + } + } + } + }, + "Header": { + "type": "object", + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "comment": { + "type": "string" + } + } + }, + "Page": { + "type": "object", + "required": [ + "startedDateTime", + "id", + "title", + "pageTimings" + ], + "properties": { + "startedDateTime": { + "type": "string" + }, + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "pageTimings": { + "type": "object", + "properties": { + "onContentLoad": { + "type": "number", + "minimum": -1 + }, + "onLoad": { + "type": "number", + "minimum": -1 + }, + "comment": { + "type": "string" + } + } + }, + "comment": { + "type": "string" + } + } + }, + "CustomHarData": { + "type": "object", + "minProperties": 1 + }, "Entry": { "type": "object", "required": [ @@ -838,144 +975,6 @@ "type": "string" } } - }, - "Header": { - "type": "object", - "required": [ - "name", - "value" - ], - "properties": { - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "comment": { - "type": "string" - } - } - }, - "Har": { - "type": "object", - "required": [ - "log" - ], - "properties": { - "log": { - "type": "object", - "externalDocs": { - "description": "HAR (HTTP Archive) Log Format", - "url": "http://www.softwareishard.com/blog/har-12-spec/" - }, - "required": [ - "version", - "creator", - "entries" - ], - "properties": { - "version": { - "type": "string" - }, - "creator": { - "type": "object", - "required": [ - "name", - "version" - ], - "properties": { - "name": { - "type": "string" - }, - "version": { - "type": "string" - }, - "comment": { - "type": "string" - } - } - }, - "browser": { - "type": "object", - "required": [ - "name", - "version" - ], - "properties": { - "name": { - "type": "string" - }, - "version": { - "type": "string" - }, - "comment": { - "type": "string" - } - } - }, - "pages": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Page" - } - }, - "entries": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Entry" - } - }, - "comment": { - "type": "string" - } - } - } - } - }, - "CustomHarData": { - "type": "object", - "minProperties": 1 - }, - "Page": { - "type": "object", - "required": [ - "startedDateTime", - "id", - "title", - "pageTimings" - ], - "properties": { - "startedDateTime": { - "type": "string", - "format": "date-time" - }, - "id": { - "type": "string" - }, - "title": { - "type": "string" - }, - "pageTimings": { - "type": "object", - "properties": { - "onContentLoad": { - "type": "number", - "minimum": -1 - }, - "onLoad": { - "type": "number", - "minimum": -1 - }, - "comment": { - "type": "string" - } - } - }, - "comment": { - "type": "string" - } - } } } } diff --git a/clients/examples/java/.gitignore b/clients/examples/java/.gitignore new file mode 100644 index 0000000000..0462914a60 --- /dev/null +++ b/clients/examples/java/.gitignore @@ -0,0 +1,82 @@ +# Created by https://www.gitignore.io + +### Gradle ### +.gradle +build/ +bin/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +.classpath +.project + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +.idea/modules.xml +.idea/*.iml +.idea/modules + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser diff --git a/clients/examples/java/build.gradle b/clients/examples/java/build.gradle new file mode 100644 index 0000000000..704aaa6ce8 --- /dev/null +++ b/clients/examples/java/build.gradle @@ -0,0 +1,39 @@ +plugins { + id 'java' +} + +group 'org.example' +version '1.0-SNAPSHOT' + +repositories { + flatDir { + dirs 'libs' + } + mavenCentral() +} + +dependencies { + implementation name: 'browserup-proxy-client-1.0.0' + + implementation 'org.seleniumhq.selenium:selenium-java:3.141.59' + implementation 'io.github.bonigarcia:webdrivermanager:4.4.3' + + // Java client dependencies, might remove it once we deploy java client to maven repo + implementation 'io.swagger:swagger-annotations:1.5.24' + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation 'com.squareup.okhttp3:okhttp:4.9.1' + implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1' + implementation 'com.google.code.gson:gson:2.8.6' + implementation 'io.gsonfire:gson-fire:1.8.4' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.10' + implementation 'org.threeten:threetenbp:1.4.3' + implementation 'javax.annotation:javax.annotation-api:1.3.2' + // Java client dependencies end + + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' +} + +test { + useJUnitPlatform() +} diff --git a/clients/examples/java/gradle/wrapper/gradle-wrapper.jar b/clients/examples/java/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..e708b1c023 Binary files /dev/null and b/clients/examples/java/gradle/wrapper/gradle-wrapper.jar differ diff --git a/clients/examples/java/gradle/wrapper/gradle-wrapper.properties b/clients/examples/java/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..da9702f9e7 --- /dev/null +++ b/clients/examples/java/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/clients/examples/java/gradlew b/clients/examples/java/gradlew new file mode 100755 index 0000000000..4f906e0c81 --- /dev/null +++ b/clients/examples/java/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/clients/examples/java/gradlew.bat b/clients/examples/java/gradlew.bat new file mode 100644 index 0000000000..ac1b06f938 --- /dev/null +++ b/clients/examples/java/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/clients/examples/java/libs/browserup-proxy-client-1.0.0.jar b/clients/examples/java/libs/browserup-proxy-client-1.0.0.jar new file mode 100644 index 0000000000..3f71097bc3 Binary files /dev/null and b/clients/examples/java/libs/browserup-proxy-client-1.0.0.jar differ diff --git a/clients/examples/java/settings.gradle b/clients/examples/java/settings.gradle new file mode 100644 index 0000000000..42bb4752c9 --- /dev/null +++ b/clients/examples/java/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'java' + diff --git a/clients/examples/java/src/main/java/com/javatest/JavaClientTest.java b/clients/examples/java/src/main/java/com/javatest/JavaClientTest.java new file mode 100644 index 0000000000..4f30214fef --- /dev/null +++ b/clients/examples/java/src/main/java/com/javatest/JavaClientTest.java @@ -0,0 +1,37 @@ +package com.javatest; + +import com.browserup.proxy.api.BrowserUpProxyApi; +import com.browserup.proxy_client.ApiClient; +import com.browserup.proxy_client.ApiException; +import com.browserup.proxy_client.Har; +import io.github.bonigarcia.wdm.WebDriverManager; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.chrome.ChromeOptions; + +public class JavaClientTest { + private static final Integer PROXY_PORT = 8080; + + public Har sendRequestAndGetHar(String url) { + WebDriverManager.chromedriver().setup(); + + var options = new ChromeOptions().addArguments( + "--headless", + "--disable-extensions", + "--proxy-server=http://localhost:" + PROXY_PORT); + + var driver = new ChromeDriver(options); + + driver.get(url); + + Har harLog; + try { + harLog = new BrowserUpProxyApi().getHarLog(); + } catch (ApiException e) { + throw new RuntimeException(e); + } finally { + driver.quit(); + } + return harLog; + } +} diff --git a/clients/examples/java/src/test/java/com/javatest/JavaClientTestTest.java b/clients/examples/java/src/test/java/com/javatest/JavaClientTestTest.java new file mode 100644 index 0000000000..d3efd66e1c --- /dev/null +++ b/clients/examples/java/src/test/java/com/javatest/JavaClientTestTest.java @@ -0,0 +1,22 @@ +package com.javatest; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +class JavaClientTestTest { + + @Test + void testSendRequestAndGetHar() { + var har = new JavaClientTest().sendRequestAndGetHar("https://google.com"); + + assertNotNull(har, "Expected HAR to be not null"); + assertNotNull(har.getLog(), "Expected HAR Log to be not null"); + assertTrue(har.getLog().getEntries().size() > 0, "Expected to get some HAR entries, found 0"); + assertTrue( + har.getLog().getEntries() + .stream() + .anyMatch(e -> e.getRequest().getUrl().toString().contains("google")), + "Expected to find HAR Entry with url containing 'google'"); + } +} diff --git a/clients/java/.openapi-generator/FILES b/clients/java/.openapi-generator/FILES index 10c578282e..df19246490 100644 --- a/clients/java/.openapi-generator/FILES +++ b/clients/java/.openapi-generator/FILES @@ -62,3 +62,19 @@ src/main/java/com/browserup/proxy_client/auth/ApiKeyAuth.java src/main/java/com/browserup/proxy_client/auth/Authentication.java src/main/java/com/browserup/proxy_client/auth/HttpBasicAuth.java src/main/java/com/browserup/proxy_client/auth/HttpBearerAuth.java +src/test/java/com/browserup/proxy/api/BrowserUpProxyApiTest.java +src/test/java/com/browserup/proxy_client/EntryRequestCookiesTest.java +src/test/java/com/browserup/proxy_client/EntryRequestQueryStringTest.java +src/test/java/com/browserup/proxy_client/EntryRequestTest.java +src/test/java/com/browserup/proxy_client/EntryResponseContentTest.java +src/test/java/com/browserup/proxy_client/EntryResponseTest.java +src/test/java/com/browserup/proxy_client/EntryTest.java +src/test/java/com/browserup/proxy_client/HarLogCreatorTest.java +src/test/java/com/browserup/proxy_client/HarLogTest.java +src/test/java/com/browserup/proxy_client/HarTest.java +src/test/java/com/browserup/proxy_client/HeaderTest.java +src/test/java/com/browserup/proxy_client/MatchCriteriaTest.java +src/test/java/com/browserup/proxy_client/NameValuePairTest.java +src/test/java/com/browserup/proxy_client/PagePageTimingsTest.java +src/test/java/com/browserup/proxy_client/PageTest.java +src/test/java/com/browserup/proxy_client/VerifyResultTest.java diff --git a/clients/java/api/openapi.yaml b/clients/java/api/openapi.yaml index dc3f6d991f..0826b3a2a1 100644 --- a/clients/java/api/openapi.yaml +++ b/clients/java/api/openapi.yaml @@ -239,12 +239,12 @@ components: schemas: NameValuePair: properties: - value: - description: Value to match - type: string name: description: Name to match type: string + value: + description: Value to match + type: string type: object MatchCriteria: description: |- @@ -343,207 +343,6 @@ components: description: Name to match type: boolean type: object - Entry: - example: - startedDateTime: startedDateTime - request: - headers: - - name: name - comment: comment - value: value - - name: name - comment: comment - value: value - httpVersion: httpVersion - method: method - headersSize: 5 - bodySize: 5 - comment: comment - queryString: - - name: name - comment: comment - value: value - - name: name - comment: comment - value: value - postData: '{}' - url: https://openapi-generator.tech - cookies: - - path: path - expires: expires - domain: domain - name: name - comment: comment - httpOnly: true - secure: true - value: value - - path: path - expires: expires - domain: domain - name: name - comment: comment - httpOnly: true - secure: true - value: value - cache: '{}' - response: - headers: - - name: name - comment: comment - value: value - - name: name - comment: comment - value: value - httpVersion: httpVersion - redirectURL: redirectURL - statusText: statusText - headersSize: 3 - bodySize: 2 - comment: comment - cookies: - - path: path - expires: expires - domain: domain - name: name - comment: comment - httpOnly: true - secure: true - value: value - - path: path - expires: expires - domain: domain - name: name - comment: comment - httpOnly: true - secure: true - value: value - content: - size: 7 - comment: comment - mimeType: mimeType - text: text - compression: 9 - encoding: encoding - status: 2 - serverIPAddress: serverIPAddress - timings: '{}' - connection: connection - comment: comment - time: 0.14658129805029452 - pageref: pageref - properties: - pageref: - type: string - startedDateTime: - type: string - time: - minimum: 0 - type: number - request: - $ref: '#/components/schemas/Entry_request' - response: - $ref: '#/components/schemas/Entry_response' - cache: - properties: - beforeRequest: - oneOf: - - type: "null" - - properties: - expires: - type: string - lastAccess: - type: string - eTag: - type: string - hitCount: - type: integer - comment: - type: string - required: - - eTag - - hitCount - - lastAccess - type: object - afterRequest: - oneOf: - - type: "null" - - properties: - expires: - type: string - lastAccess: - type: string - eTag: - type: string - hitCount: - type: integer - comment: - type: string - required: - - eTag - - hitCount - - lastAccess - type: object - comment: - type: string - timings: - properties: - dns: - minimum: -1 - type: number - connect: - minimum: -1 - type: number - blocked: - minimum: -1 - type: number - send: - minimum: -1 - type: number - wait: - minimum: -1 - type: number - receive: - minimum: -1 - type: number - ssl: - minimum: -1 - type: number - comment: - type: string - required: - - receive - - send - - wait - serverIPAddress: - type: string - connection: - type: string - comment: - type: string - required: - - cache - - request - - response - - startedDateTime - - time - - timings - type: object - Header: - example: - name: name - comment: comment - value: value - properties: - name: - type: string - value: - type: string - comment: - type: string - required: - - name - - value - type: object Har: example: log: @@ -552,7 +351,7 @@ components: comment: comment version: version entries: - - startedDateTime: startedDateTime + - startedDateTime: 2000-01-23T04:56:07.000+00:00 request: headers: - name: name @@ -638,7 +437,7 @@ components: comment: comment time: 0.14658129805029452 pageref: pageref - - startedDateTime: startedDateTime + - startedDateTime: 2000-01-23T04:56:07.000+00:00 request: headers: - name: name @@ -753,8 +552,21 @@ components: required: - log type: object - CustomHarData: - minProperties: 1 + Header: + example: + name: name + comment: comment + value: value + properties: + name: + type: string + value: + type: string + comment: + type: string + required: + - name + - value type: object Page: example: @@ -784,253 +596,194 @@ components: - startedDateTime - title type: object - Entry_request_cookies: + CustomHarData: + minProperties: 1 + type: object + Entry: example: - path: path - expires: expires - domain: domain - name: name - comment: comment - httpOnly: true - secure: true - value: value - properties: - name: - type: string - value: - type: string - path: - type: string - domain: - type: string - expires: - type: string - httpOnly: - type: boolean - secure: - type: boolean - comment: - type: string - required: - - name - - value - type: object - Entry_request_queryString: - example: - name: name - comment: comment - value: value - properties: - name: - type: string - value: - type: string - comment: - type: string - required: - - name - - value - type: object - Entry_request: - example: - headers: - - name: name + startedDateTime: 2000-01-23T04:56:07.000+00:00 + request: + headers: + - name: name + comment: comment + value: value + - name: name + comment: comment + value: value + httpVersion: httpVersion + method: method + headersSize: 5 + bodySize: 5 comment: comment - value: value - - name: name + queryString: + - name: name + comment: comment + value: value + - name: name + comment: comment + value: value + postData: '{}' + url: https://openapi-generator.tech + cookies: + - path: path + expires: expires + domain: domain + name: name + comment: comment + httpOnly: true + secure: true + value: value + - path: path + expires: expires + domain: domain + name: name + comment: comment + httpOnly: true + secure: true + value: value + cache: '{}' + response: + headers: + - name: name + comment: comment + value: value + - name: name + comment: comment + value: value + httpVersion: httpVersion + redirectURL: redirectURL + statusText: statusText + headersSize: 3 + bodySize: 2 comment: comment - value: value - httpVersion: httpVersion - method: method - headersSize: 5 - bodySize: 5 + cookies: + - path: path + expires: expires + domain: domain + name: name + comment: comment + httpOnly: true + secure: true + value: value + - path: path + expires: expires + domain: domain + name: name + comment: comment + httpOnly: true + secure: true + value: value + content: + size: 7 + comment: comment + mimeType: mimeType + text: text + compression: 9 + encoding: encoding + status: 2 + serverIPAddress: serverIPAddress + timings: '{}' + connection: connection comment: comment - queryString: - - name: name - comment: comment - value: value - - name: name - comment: comment - value: value - postData: '{}' - url: https://openapi-generator.tech - cookies: - - path: path - expires: expires - domain: domain - name: name - comment: comment - httpOnly: true - secure: true - value: value - - path: path - expires: expires - domain: domain - name: name - comment: comment - httpOnly: true - secure: true - value: value + time: 0.14658129805029452 + pageref: pageref properties: - method: - type: string - url: - format: uri + pageref: type: string - httpVersion: + startedDateTime: + format: date-time type: string - cookies: - items: - $ref: '#/components/schemas/Entry_request_cookies' - type: array - headers: - items: - $ref: '#/components/schemas/Header' - type: array - queryString: - items: - $ref: '#/components/schemas/Entry_request_queryString' - type: array - postData: - description: Posted data info. + time: + minimum: 0 + type: number + request: + $ref: '#/components/schemas/Entry_request' + response: + $ref: '#/components/schemas/Entry_response' + cache: properties: - mimeType: - type: string - text: - type: string - params: - items: - properties: - name: + beforeRequest: + oneOf: + - type: "null" + - properties: + expires: type: string - value: + lastAccess: type: string - fileName: + eTag: type: string - contentType: + hitCount: + type: integer + comment: + type: string + required: + - eTag + - hitCount + - lastAccess + type: object + afterRequest: + oneOf: + - type: "null" + - properties: + expires: type: string + lastAccess: + type: string + eTag: + type: string + hitCount: + type: integer comment: type: string + required: + - eTag + - hitCount + - lastAccess type: object - type: array + comment: + type: string + timings: + properties: + dns: + minimum: -1 + type: number + connect: + minimum: -1 + type: number + blocked: + minimum: -1 + type: number + send: + minimum: -1 + type: number + wait: + minimum: -1 + type: number + receive: + minimum: -1 + type: number + ssl: + minimum: -1 + type: number + comment: + type: string required: - - mimeType - headersSize: - type: integer - bodySize: - type: integer - comment: - type: string - required: - - bodySize - - cookies - - headers - - headersSize - - httpVersion - - method - - queryString - - url - type: object - Entry_response_content: - example: - size: 7 - comment: comment - mimeType: mimeType - text: text - compression: 9 - encoding: encoding - properties: - size: - type: integer - compression: - type: integer - mimeType: - type: string - text: - type: string - encoding: - type: string - comment: - type: string - required: - - mimeType - - size - type: object - Entry_response: - example: - headers: - - name: name - comment: comment - value: value - - name: name - comment: comment - value: value - httpVersion: httpVersion - redirectURL: redirectURL - statusText: statusText - headersSize: 3 - bodySize: 2 - comment: comment - cookies: - - path: path - expires: expires - domain: domain - name: name - comment: comment - httpOnly: true - secure: true - value: value - - path: path - expires: expires - domain: domain - name: name - comment: comment - httpOnly: true - secure: true - value: value - content: - size: 7 - comment: comment - mimeType: mimeType - text: text - compression: 9 - encoding: encoding - status: 2 - properties: - status: - type: integer - statusText: - type: string - httpVersion: + - receive + - send + - wait + serverIPAddress: type: string - cookies: - items: - $ref: '#/components/schemas/Entry_request_cookies' - type: array - headers: - items: - $ref: '#/components/schemas/Header' - type: array - content: - $ref: '#/components/schemas/Entry_response_content' - redirectURL: + connection: type: string - headersSize: - type: integer - bodySize: - type: integer comment: type: string required: - - bodySize - - content - - cookies - - headers - - headersSize - - httpVersion - - redirectURL - - status - - statusText + - cache + - request + - response + - startedDateTime + - time + - timings type: object Har_log_creator: example: @@ -1055,7 +808,7 @@ components: comment: comment version: version entries: - - startedDateTime: startedDateTime + - startedDateTime: 2000-01-23T04:56:07.000+00:00 request: headers: - name: name @@ -1141,7 +894,7 @@ components: comment: comment time: 0.14658129805029452 pageref: pageref - - startedDateTime: startedDateTime + - startedDateTime: 2000-01-23T04:56:07.000+00:00 request: headers: - name: name @@ -1290,4 +1043,252 @@ components: comment: type: string type: object + Entry_request_cookies: + example: + path: path + expires: expires + domain: domain + name: name + comment: comment + httpOnly: true + secure: true + value: value + properties: + name: + type: string + value: + type: string + path: + type: string + domain: + type: string + expires: + type: string + httpOnly: + type: boolean + secure: + type: boolean + comment: + type: string + required: + - name + - value + type: object + Entry_request_queryString: + example: + name: name + comment: comment + value: value + properties: + name: + type: string + value: + type: string + comment: + type: string + required: + - name + - value + type: object + Entry_request: + example: + headers: + - name: name + comment: comment + value: value + - name: name + comment: comment + value: value + httpVersion: httpVersion + method: method + headersSize: 5 + bodySize: 5 + comment: comment + queryString: + - name: name + comment: comment + value: value + - name: name + comment: comment + value: value + postData: '{}' + url: https://openapi-generator.tech + cookies: + - path: path + expires: expires + domain: domain + name: name + comment: comment + httpOnly: true + secure: true + value: value + - path: path + expires: expires + domain: domain + name: name + comment: comment + httpOnly: true + secure: true + value: value + properties: + method: + type: string + url: + format: uri + type: string + httpVersion: + type: string + cookies: + items: + $ref: '#/components/schemas/Entry_request_cookies' + type: array + headers: + items: + $ref: '#/components/schemas/Header' + type: array + queryString: + items: + $ref: '#/components/schemas/Entry_request_queryString' + type: array + postData: + description: Posted data info. + properties: + mimeType: + type: string + text: + type: string + params: + items: + properties: + name: + type: string + value: + type: string + fileName: + type: string + contentType: + type: string + comment: + type: string + type: object + type: array + required: + - mimeType + headersSize: + type: integer + bodySize: + type: integer + comment: + type: string + required: + - bodySize + - cookies + - headers + - headersSize + - httpVersion + - method + - queryString + - url + type: object + Entry_response_content: + example: + size: 7 + comment: comment + mimeType: mimeType + text: text + compression: 9 + encoding: encoding + properties: + size: + type: integer + compression: + type: integer + mimeType: + type: string + text: + type: string + encoding: + type: string + comment: + type: string + required: + - mimeType + - size + type: object + Entry_response: + example: + headers: + - name: name + comment: comment + value: value + - name: name + comment: comment + value: value + httpVersion: httpVersion + redirectURL: redirectURL + statusText: statusText + headersSize: 3 + bodySize: 2 + comment: comment + cookies: + - path: path + expires: expires + domain: domain + name: name + comment: comment + httpOnly: true + secure: true + value: value + - path: path + expires: expires + domain: domain + name: name + comment: comment + httpOnly: true + secure: true + value: value + content: + size: 7 + comment: comment + mimeType: mimeType + text: text + compression: 9 + encoding: encoding + status: 2 + properties: + status: + type: integer + statusText: + type: string + httpVersion: + type: string + cookies: + items: + $ref: '#/components/schemas/Entry_request_cookies' + type: array + headers: + items: + $ref: '#/components/schemas/Header' + type: array + content: + $ref: '#/components/schemas/Entry_response_content' + redirectURL: + type: string + headersSize: + type: integer + bodySize: + type: integer + comment: + type: string + required: + - bodySize + - content + - cookies + - headers + - headersSize + - httpVersion + - redirectURL + - status + - statusText + type: object diff --git a/clients/java/docs/Entry.md b/clients/java/docs/Entry.md index 4852472efa..a912ff2ffb 100644 --- a/clients/java/docs/Entry.md +++ b/clients/java/docs/Entry.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **pageref** | **String** | | [optional] -**startedDateTime** | **String** | | +**startedDateTime** | **OffsetDateTime** | | **time** | **BigDecimal** | | **request** | [**EntryRequest**](EntryRequest.md) | | **response** | [**EntryResponse**](EntryResponse.md) | | diff --git a/clients/java/docs/NameValuePair.md b/clients/java/docs/NameValuePair.md index b0ddf6b499..96ddee1588 100644 --- a/clients/java/docs/NameValuePair.md +++ b/clients/java/docs/NameValuePair.md @@ -7,8 +7,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**value** | **String** | Value to match | [optional] **name** | **String** | Name to match | [optional] +**value** | **String** | Value to match | [optional] diff --git a/clients/java/gradlew b/clients/java/gradlew old mode 100644 new mode 100755 diff --git a/clients/java/openapitools.json b/clients/java/openapitools.json new file mode 100644 index 0000000000..d2fdbae832 --- /dev/null +++ b/clients/java/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "5.1.1" + } +} diff --git a/clients/java/src/main/java/com/browserup/proxy_client/Entry.java b/clients/java/src/main/java/com/browserup/proxy_client/Entry.java index 06df4d7e81..cbe088ecd8 100644 --- a/clients/java/src/main/java/com/browserup/proxy_client/Entry.java +++ b/clients/java/src/main/java/com/browserup/proxy_client/Entry.java @@ -26,6 +26,7 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.math.BigDecimal; +import org.threeten.bp.OffsetDateTime; /** * Entry @@ -38,7 +39,7 @@ public class Entry { public static final String SERIALIZED_NAME_STARTED_DATE_TIME = "startedDateTime"; @SerializedName(SERIALIZED_NAME_STARTED_DATE_TIME) - private String startedDateTime; + private OffsetDateTime startedDateTime; public static final String SERIALIZED_NAME_TIME = "time"; @SerializedName(SERIALIZED_NAME_TIME) @@ -96,7 +97,7 @@ public void setPageref(String pageref) { } - public Entry startedDateTime(String startedDateTime) { + public Entry startedDateTime(OffsetDateTime startedDateTime) { this.startedDateTime = startedDateTime; return this; @@ -108,12 +109,12 @@ public Entry startedDateTime(String startedDateTime) { **/ @ApiModelProperty(required = true, value = "") - public String getStartedDateTime() { + public OffsetDateTime getStartedDateTime() { return startedDateTime; } - public void setStartedDateTime(String startedDateTime) { + public void setStartedDateTime(OffsetDateTime startedDateTime) { this.startedDateTime = startedDateTime; } diff --git a/clients/java/src/main/java/com/browserup/proxy_client/NameValuePair.java b/clients/java/src/main/java/com/browserup/proxy_client/NameValuePair.java index 356ff65083..3622ec0521 100644 --- a/clients/java/src/main/java/com/browserup/proxy_client/NameValuePair.java +++ b/clients/java/src/main/java/com/browserup/proxy_client/NameValuePair.java @@ -29,58 +29,58 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class NameValuePair { - public static final String SERIALIZED_NAME_VALUE = "value"; - @SerializedName(SERIALIZED_NAME_VALUE) - private String value; - public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) private String name; + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value; + - public NameValuePair value(String value) { + public NameValuePair name(String name) { - this.value = value; + this.name = name; return this; } /** - * Value to match - * @return value + * Name to match + * @return name **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Value to match") + @ApiModelProperty(value = "Name to match") - public String getValue() { - return value; + public String getName() { + return name; } - public void setValue(String value) { - this.value = value; + public void setName(String name) { + this.name = name; } - public NameValuePair name(String name) { + public NameValuePair value(String value) { - this.name = name; + this.value = value; return this; } /** - * Name to match - * @return name + * Value to match + * @return value **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Name to match") + @ApiModelProperty(value = "Value to match") - public String getName() { - return name; + public String getValue() { + return value; } - public void setName(String name) { - this.name = name; + public void setValue(String value) { + this.value = value; } @@ -93,21 +93,21 @@ public boolean equals(Object o) { return false; } NameValuePair nameValuePair = (NameValuePair) o; - return Objects.equals(this.value, nameValuePair.value) && - Objects.equals(this.name, nameValuePair.name); + return Objects.equals(this.name, nameValuePair.name) && + Objects.equals(this.value, nameValuePair.value); } @Override public int hashCode() { - return Objects.hash(value, name); + return Objects.hash(name, value); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class NameValuePair {\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/clients/java/src/test/java/com/browserup/proxy/api/BrowserUpProxyApiTest.java b/clients/java/src/test/java/com/browserup/proxy/api/BrowserUpProxyApiTest.java index 0a99b70170..c25ac90541 100644 --- a/clients/java/src/test/java/com/browserup/proxy/api/BrowserUpProxyApiTest.java +++ b/clients/java/src/test/java/com/browserup/proxy/api/BrowserUpProxyApiTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/EntryRequestCookiesTest.java b/clients/java/src/test/java/com/browserup/proxy_client/EntryRequestCookiesTest.java index 74415f83ff..489e9e3670 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/EntryRequestCookiesTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/EntryRequestCookiesTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/EntryRequestQueryStringTest.java b/clients/java/src/test/java/com/browserup/proxy_client/EntryRequestQueryStringTest.java index 1fdaa352da..e0f20e18f9 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/EntryRequestQueryStringTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/EntryRequestQueryStringTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/EntryRequestTest.java b/clients/java/src/test/java/com/browserup/proxy_client/EntryRequestTest.java index a229b22380..a6db8c2be3 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/EntryRequestTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/EntryRequestTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/EntryResponseContentTest.java b/clients/java/src/test/java/com/browserup/proxy_client/EntryResponseContentTest.java index be394cb1c6..2248bccaf4 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/EntryResponseContentTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/EntryResponseContentTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/EntryResponseTest.java b/clients/java/src/test/java/com/browserup/proxy_client/EntryResponseTest.java index 9defbc8865..dfb9a73375 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/EntryResponseTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/EntryResponseTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/EntryTest.java b/clients/java/src/test/java/com/browserup/proxy_client/EntryTest.java index a8348ce12d..31af580a3c 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/EntryTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/EntryTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * @@ -24,6 +24,7 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.math.BigDecimal; +import org.threeten.bp.OffsetDateTime; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; diff --git a/clients/java/src/test/java/com/browserup/proxy_client/HarLogCreatorTest.java b/clients/java/src/test/java/com/browserup/proxy_client/HarLogCreatorTest.java index caade1631e..b3142fc820 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/HarLogCreatorTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/HarLogCreatorTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/HarLogTest.java b/clients/java/src/test/java/com/browserup/proxy_client/HarLogTest.java index 15858f411c..acc4e3b36b 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/HarLogTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/HarLogTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/HarTest.java b/clients/java/src/test/java/com/browserup/proxy_client/HarTest.java index 807c0e62e8..7915a9269f 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/HarTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/HarTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/HeaderTest.java b/clients/java/src/test/java/com/browserup/proxy_client/HeaderTest.java index f5f59ad733..cc91ba3f80 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/HeaderTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/HeaderTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/MatchCriteriaTest.java b/clients/java/src/test/java/com/browserup/proxy_client/MatchCriteriaTest.java index 40721a9e99..75f6ea68fc 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/MatchCriteriaTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/MatchCriteriaTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/NameValuePairTest.java b/clients/java/src/test/java/com/browserup/proxy_client/NameValuePairTest.java index aa31621596..6adda7e336 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/NameValuePairTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/NameValuePairTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * @@ -41,19 +41,19 @@ public void testNameValuePair() { } /** - * Test the property 'value' + * Test the property 'name' */ @Test - public void valueTest() { - // TODO: test value + public void nameTest() { + // TODO: test name } /** - * Test the property 'name' + * Test the property 'value' */ @Test - public void nameTest() { - // TODO: test name + public void valueTest() { + // TODO: test value } } diff --git a/clients/java/src/test/java/com/browserup/proxy_client/PagePageTimingsTest.java b/clients/java/src/test/java/com/browserup/proxy_client/PagePageTimingsTest.java index 29aea6e305..5c6b790e6e 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/PagePageTimingsTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/PagePageTimingsTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/PageTest.java b/clients/java/src/test/java/com/browserup/proxy_client/PageTest.java index a42f083e05..5382fb0d9d 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/PageTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/PageTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/java/src/test/java/com/browserup/proxy_client/VerifyResultTest.java b/clients/java/src/test/java/com/browserup/proxy_client/VerifyResultTest.java index 578c4f6770..fdeb1db5a4 100644 --- a/clients/java/src/test/java/com/browserup/proxy_client/VerifyResultTest.java +++ b/clients/java/src/test/java/com/browserup/proxy_client/VerifyResultTest.java @@ -1,6 +1,6 @@ /* * BrowserUp Proxy - * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ + * ___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___ * * The version of the OpenAPI document: 1.0.0 * diff --git a/clients/openapitools.json b/clients/openapitools.json new file mode 100644 index 0000000000..d2fdbae832 --- /dev/null +++ b/clients/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "5.1.1" + } +} diff --git a/mitmproxy/addons/browserup/har/har_builder.py b/mitmproxy/addons/browserup/har/har_builder.py index 0e2208f320..662b8175a9 100644 --- a/mitmproxy/addons/browserup/har/har_builder.py +++ b/mitmproxy/addons/browserup/har/har_builder.py @@ -1,4 +1,5 @@ from datetime import datetime +from datetime import timezone class HarBuilder(): @@ -32,7 +33,7 @@ def page_timings(): } @staticmethod - def page(title="", id="", started_date_time=datetime.utcnow().isoformat()): + def page(title="", id="", started_date_time=str(datetime.now(tz=timezone.utc).isoformat())): return { "title": title, "id": id, diff --git a/mitmproxy/addons/browserup/har/har_resources.py b/mitmproxy/addons/browserup/har/har_resources.py index 7705f953da..5923ac220d 100644 --- a/mitmproxy/addons/browserup/har/har_resources.py +++ b/mitmproxy/addons/browserup/har/har_resources.py @@ -33,7 +33,7 @@ class RespondWithHarMixin: def respond_with_har(self, resp, har, har_file): resp.status = falcon.HTTP_200 resp.content_type = falcon.MEDIA_JSON - resp.body = json.dumps({"path": har_file.name, "json": har}, ensure_ascii=False) + resp.body = json.dumps(har, ensure_ascii=False) class VerifyResponseMixin: diff --git a/mitmproxy/addons/browserup/schemas/Entry.json b/mitmproxy/addons/browserup/schemas/Entry.json index 3f8c80df60..37f3e292eb 100644 --- a/mitmproxy/addons/browserup/schemas/Entry.json +++ b/mitmproxy/addons/browserup/schemas/Entry.json @@ -378,4 +378,4 @@ "type": "string" } } -} \ No newline at end of file +} diff --git a/mitmproxy/addons/browserup/schemas/Page.json b/mitmproxy/addons/browserup/schemas/Page.json index 6de3e5bcb4..7028cb5be3 100644 --- a/mitmproxy/addons/browserup/schemas/Page.json +++ b/mitmproxy/addons/browserup/schemas/Page.json @@ -8,8 +8,7 @@ ], "properties": { "startedDateTime": { - "type": "string", - "format": "date-time" + "type": "string" }, "id": { "type": "string" @@ -37,4 +36,4 @@ "type": "string" } } -} \ No newline at end of file +} diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 0000000000..d2fdbae832 --- /dev/null +++ b/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "5.1.1" + } +}