github.com/hellofresh/janus@v0.0.0-20230925145208-ce8de8183c67/pkg/api/api_test.go (about)

     1  package api_test
     2  
     3  import (
     4  	"encoding/json"
     5  	"testing"
     6  
     7  	"github.com/hellofresh/janus/pkg/api"
     8  	"github.com/hellofresh/janus/pkg/proxy"
     9  	"github.com/stretchr/testify/assert"
    10  	"github.com/stretchr/testify/require"
    11  )
    12  
    13  func TestNewInstanceOfDefinition(t *testing.T) {
    14  	instance := api.NewDefinition()
    15  
    16  	assert.IsType(t, &api.Definition{}, instance)
    17  	assert.True(t, instance.Active)
    18  }
    19  
    20  func TestSuccessfulValidation(t *testing.T) {
    21  	instance := api.NewDefinition()
    22  	instance.Name = "Test"
    23  	instance.Proxy.ListenPath = "/"
    24  	instance.Proxy.Upstreams = &proxy.Upstreams{
    25  		Balancing: "roundrobin",
    26  		Targets: []*proxy.Target{
    27  			{Target: "http:/example.com"},
    28  		},
    29  	}
    30  
    31  	isValid, err := instance.Validate()
    32  	require.NoError(t, err)
    33  	assert.True(t, isValid)
    34  }
    35  
    36  func TestFailedValidation(t *testing.T) {
    37  	instance := api.NewDefinition()
    38  	isValid, err := instance.Validate()
    39  
    40  	assert.Error(t, err)
    41  	assert.False(t, isValid)
    42  }
    43  
    44  func TestNameValidation(t *testing.T) {
    45  	instanceSimple := api.NewDefinition()
    46  	instanceSimple.Name = "simple"
    47  	instanceSimple.Proxy.ListenPath = "/"
    48  	isValid, err := instanceSimple.Validate()
    49  
    50  	require.NoError(t, err)
    51  	require.True(t, isValid)
    52  
    53  	instanceDash := api.NewDefinition()
    54  	instanceDash.Name = "with-dash-and-123"
    55  	instanceDash.Proxy.ListenPath = "/"
    56  	isValid, err = instanceDash.Validate()
    57  
    58  	require.NoError(t, err)
    59  	require.True(t, isValid)
    60  
    61  	instanceBadSymbol := api.NewDefinition()
    62  	instanceBadSymbol.Name = "test~"
    63  	instanceBadSymbol.Proxy.ListenPath = "/"
    64  	isValid, err = instanceBadSymbol.Validate()
    65  
    66  	require.Error(t, err)
    67  	require.False(t, isValid)
    68  }
    69  
    70  func TestConfiguration_EqualsTo(t *testing.T) {
    71  	def11 := api.NewDefinition()
    72  	def12 := api.NewDefinition()
    73  	def13 := api.NewDefinition()
    74  	def14 := api.NewDefinition()
    75  
    76  	def21 := api.NewDefinition()
    77  	def22 := api.NewDefinition()
    78  	def23 := api.NewDefinition()
    79  	def24 := api.NewDefinition()
    80  
    81  	require.NoError(t, json.Unmarshal([]byte(def1), &def11))
    82  	require.NoError(t, json.Unmarshal([]byte(def2), &def12))
    83  	require.NoError(t, json.Unmarshal([]byte(def3), &def13))
    84  	require.NoError(t, json.Unmarshal([]byte(def4), &def14))
    85  
    86  	require.NoError(t, json.Unmarshal([]byte(def1), &def21))
    87  	require.NoError(t, json.Unmarshal([]byte(def2), &def22))
    88  	require.NoError(t, json.Unmarshal([]byte(def3), &def23))
    89  	require.NoError(t, json.Unmarshal([]byte(def4), &def24))
    90  
    91  	c1 := &api.Configuration{
    92  		Definitions: []*api.Definition{def11, def12, def13, def14},
    93  	}
    94  	c2 := &api.Configuration{
    95  		Definitions: []*api.Definition{def21, def22, def23, def24},
    96  	}
    97  
    98  	assert.True(t, c1.EqualsTo(c2))
    99  	assert.True(t, c2.EqualsTo(c1))
   100  }
   101  
   102  const (
   103  	def1 = `{
   104      "name" : "users",
   105      "active" : true,
   106      "proxy" : {
   107          "preserve_host" : false,
   108          "listen_path" : "/users/*",
   109          "upstreams" : {
   110              "balancing" : "weight",
   111              "targets" : [
   112                  {
   113                      "target" : "http://localhost:8000/users",
   114                      "weight" : 0
   115                  },
   116                  {
   117                      "target" : "http://auth-service.live-k8s.hellofresh.io/users",
   118                      "weight" : 100
   119                  }
   120              ]
   121          },
   122          "insecure_skip_verify" : false,
   123          "strip_path" : true,
   124          "append_path" : false,
   125          "enable_load_balancing" : false,
   126          "methods" : [
   127              "ALL"
   128          ],
   129          "hosts" : []
   130      },
   131      "plugins" : [
   132          {
   133              "name" : "cors",
   134              "enabled" : true,
   135              "config" : {
   136                  "request_headers" : [
   137                      "Accept",
   138                      "Accept-CH",
   139                      "Accept-Charset",
   140                      "Accept-Datetime",
   141                      "Accept-Encoding",
   142                      "Accept-Ext",
   143                      "Accept-Features",
   144                      "Accept-Language",
   145                      "Accept-Params",
   146                      "Accept-Ranges",
   147                      "Access-Control-Allow-Credentials",
   148                      "Access-Control-Allow-Headers",
   149                      "Access-Control-Allow-Methods",
   150                      "Access-Control-Allow-Origin",
   151                      "Access-Control-Expose-Headers",
   152                      "Access-Control-Max-Age",
   153                      "Access-Control-Request-Headers",
   154                      "Access-Control-Request-Method",
   155                      "Age",
   156                      "Allow",
   157                      "Alternates",
   158                      "Authentication-Info",
   159                      "Authorization",
   160                      "C-Ext",
   161                      "C-Man",
   162                      "C-Opt",
   163                      "C-PEP",
   164                      "C-PEP-Info",
   165                      "CONNECT",
   166                      "Cache-Control",
   167                      "Compliance",
   168                      "Connection",
   169                      "Content-Base",
   170                      "Content-Disposition",
   171                      "Content-Encoding",
   172                      "Content-ID",
   173                      "Content-Language",
   174                      "Content-Length",
   175                      "Content-Location",
   176                      "Content-MD5",
   177                      "Content-Range",
   178                      "Content-Script-Type",
   179                      "Content-Security-Policy",
   180                      "Content-Style-Type",
   181                      "Content-Transfer-Encoding",
   182                      "Content-Type",
   183                      "Content-Version",
   184                      "Cookie",
   185                      "Cost",
   186                      "DAV",
   187                      "DELETE",
   188                      "DNT",
   189                      "DPR",
   190                      "Date",
   191                      "Default-Style",
   192                      "Delta-Base",
   193                      "Depth",
   194                      "Derived-From",
   195                      "Destination",
   196                      "Differential-ID",
   197                      "Digest",
   198                      "ETag",
   199                      "Expect",
   200                      "Expires",
   201                      "Ext",
   202                      "From",
   203                      "GET",
   204                      "GetProfile",
   205                      "HEAD",
   206                      "HTTP-date",
   207                      "Host",
   208                      "IM",
   209                      "If",
   210                      "If-Match",
   211                      "If-Modified-Since",
   212                      "If-None-Match",
   213                      "If-Range",
   214                      "If-Unmodified-Since",
   215                      "Keep-Alive",
   216                      "Label",
   217                      "Last-Event-ID",
   218                      "Last-Modified",
   219                      "Link",
   220                      "Location",
   221                      "Lock-Token",
   222                      "MIME-Version",
   223                      "Man",
   224                      "Max-Forwards",
   225                      "Media-Range",
   226                      "Message-ID",
   227                      "Meter",
   228                      "Negotiate",
   229                      "Non-Compliance",
   230                      "OPTION",
   231                      "OPTIONS",
   232                      "OWS",
   233                      "Opt",
   234                      "Optional",
   235                      "Ordering-Type",
   236                      "Origin",
   237                      "Overwrite",
   238                      "P3P",
   239                      "PEP",
   240                      "PICS-Label",
   241                      "POST",
   242                      "PUT",
   243                      "Pep-Info",
   244                      "Permanent",
   245                      "Position",
   246                      "Pragma",
   247                      "ProfileObject",
   248                      "Protocol",
   249                      "Protocol-Query",
   250                      "Protocol-Request",
   251                      "Proxy-Authenticate",
   252                      "Proxy-Authentication-Info",
   253                      "Proxy-Authorization",
   254                      "Proxy-Features",
   255                      "Proxy-Instruction",
   256                      "Public",
   257                      "RWS",
   258                      "Range",
   259                      "Referer",
   260                      "Refresh",
   261                      "Resolution-Hint",
   262                      "Resolver-Location",
   263                      "Retry-After",
   264                      "Safe",
   265                      "Sec-Websocket-Extensions",
   266                      "Sec-Websocket-Key",
   267                      "Sec-Websocket-Origin",
   268                      "Sec-Websocket-Protocol",
   269                      "Sec-Websocket-Version",
   270                      "Security-Scheme",
   271                      "Server",
   272                      "Set-Cookie",
   273                      "Set-Cookie2",
   274                      "SetProfile",
   275                      "SoapAction",
   276                      "Status",
   277                      "Status-URI",
   278                      "Strict-Transport-Security",
   279                      "SubOK",
   280                      "Subst",
   281                      "Surrogate-Capability",
   282                      "Surrogate-Control",
   283                      "TCN",
   284                      "TE",
   285                      "TRACE",
   286                      "Timeout",
   287                      "Title",
   288                      "Trailer",
   289                      "Transfer-Encoding",
   290                      "UA-Color",
   291                      "UA-Media",
   292                      "UA-Pixels",
   293                      "UA-Resolution",
   294                      "UA-Windowpixels",
   295                      "URI",
   296                      "Upgrade",
   297                      "User-Agent",
   298                      "Variant-Vary",
   299                      "Vary",
   300                      "Version",
   301                      "Via",
   302                      "Viewport-Width",
   303                      "WWW-Authenticate",
   304                      "Want-Digest",
   305                      "Warning",
   306                      "Width",
   307                      "X-Content-Duration",
   308                      "X-Content-Security-Policy",
   309                      "X-Content-Type-Options",
   310                      "X-CustomHeader",
   311                      "X-DNSPrefetch-Control",
   312                      "X-Forwarded-For",
   313                      "X-Forwarded-Port",
   314                      "X-Forwarded-Proto",
   315                      "X-Frame-Options",
   316                      "X-Modified",
   317                      "X-OTHER",
   318                      "X-PING",
   319                      "X-PINGOTHER",
   320                      "X-Powered-By",
   321                      "X-Requested-With"
   322                  ],
   323                  "domains" : [
   324                      "*"
   325                  ],
   326                  "exposed_headers" : [
   327                      "X-Debug-Token",
   328                      "X-Debug-Token-Link"
   329                  ],
   330                  "methods" : [
   331                      "CONNECT",
   332                      "DEBUG",
   333                      "DELETE",
   334                      "DONE",
   335                      "GET",
   336                      "HEAD",
   337                      "HTTP",
   338                      "HTTP/0.9",
   339                      "HTTP/1.0",
   340                      "HTTP/1.1",
   341                      "HTTP/2",
   342                      "OPTIONS",
   343                      "ORIGIN",
   344                      "ORIGINS",
   345                      "PATCH",
   346                      "POST",
   347                      "PUT",
   348                      "QUIC",
   349                      "REST",
   350                      "SESSION",
   351                      "SHOULD",
   352                      "SPDY",
   353                      "TRACE",
   354                      "TRACK"
   355                  ]
   356              }
   357          },
   358          {
   359              "name" : "rate_limit",
   360              "enabled" : false,
   361              "config" : {
   362                  "limit" : "50-S",
   363                  "policy" : "local"
   364              }
   365          },
   366          {
   367              "name" : "oauth2",
   368              "enabled" : true,
   369              "config" : {
   370                  "server_name" : "live oauth server"
   371              }
   372          },
   373          {
   374              "name" : "compression",
   375              "enabled" : false,
   376              "config" : {}
   377          }
   378      ],
   379      "health_check" : {
   380          "url" : "",
   381          "timeout" : 0
   382      }
   383  }`
   384  	def2 = `{
   385      "name" : "csi-users",
   386      "active" : true,
   387      "domain" : "",
   388      "proxy" : {
   389          "listen_path" : "/csi/user/*",
   390          "append_listen_path" : false,
   391          "target_list" : [],
   392          "methods" : [
   393              "ALL"
   394          ],
   395          "preserve_host" : false,
   396          "strip_path" : true,
   397          "upstreams" : {
   398              "balancing" : "roundrobin",
   399              "targets" : [
   400                  {
   401                      "target" : "http://localhost:5004/user"
   402                  }
   403              ]
   404          }
   405      },
   406      "allowed_ips" : [],
   407      "oauth_server_name" : "live oauth server",
   408      "plugins" : [
   409          {
   410              "name" : "cors",
   411              "enabled" : true,
   412              "config" : {
   413                  "domains" : [
   414                      "*"
   415                  ],
   416                  "methods" : [
   417                      "CONNECT",
   418                      "DEBUG",
   419                      "DELETE",
   420                      "DONE",
   421                      "GET",
   422                      "HEAD",
   423                      "HTTP",
   424                      "HTTP/0.9",
   425                      "HTTP/1.0",
   426                      "HTTP/1.1",
   427                      "HTTP/2",
   428                      "OPTIONS",
   429                      "ORIGIN",
   430                      "ORIGINS",
   431                      "PATCH",
   432                      "POST",
   433                      "PUT",
   434                      "QUIC",
   435                      "REST",
   436                      "SESSION",
   437                      "SHOULD",
   438                      "SPDY",
   439                      "TRACE",
   440                      "TRACK"
   441                  ],
   442                  "request_headers" : [
   443                      "Accept",
   444                      "Accept-CH",
   445                      "Accept-Charset",
   446                      "Accept-Datetime",
   447                      "Accept-Encoding",
   448                      "Accept-Ext",
   449                      "Accept-Features",
   450                      "Accept-Language",
   451                      "Accept-Params",
   452                      "Accept-Ranges",
   453                      "Access-Control-Allow-Credentials",
   454                      "Access-Control-Allow-Headers",
   455                      "Access-Control-Allow-Methods",
   456                      "Access-Control-Allow-Origin",
   457                      "Access-Control-Expose-Headers",
   458                      "Access-Control-Max-Age",
   459                      "Access-Control-Request-Headers",
   460                      "Access-Control-Request-Method",
   461                      "Age",
   462                      "Allow",
   463                      "Alternates",
   464                      "Authentication-Info",
   465                      "Authorization",
   466                      "C-Ext",
   467                      "C-Man",
   468                      "C-Opt",
   469                      "C-PEP",
   470                      "C-PEP-Info",
   471                      "CONNECT",
   472                      "Cache-Control",
   473                      "Compliance",
   474                      "Connection",
   475                      "Content-Base",
   476                      "Content-Disposition",
   477                      "Content-Encoding",
   478                      "Content-ID",
   479                      "Content-Language",
   480                      "Content-Length",
   481                      "Content-Location",
   482                      "Content-MD5",
   483                      "Content-Range",
   484                      "Content-Script-Type",
   485                      "Content-Security-Policy",
   486                      "Content-Style-Type",
   487                      "Content-Transfer-Encoding",
   488                      "Content-Type",
   489                      "Content-Version",
   490                      "Cookie",
   491                      "Cost",
   492                      "DAV",
   493                      "DELETE",
   494                      "DNT",
   495                      "DPR",
   496                      "Date",
   497                      "Default-Style",
   498                      "Delta-Base",
   499                      "Depth",
   500                      "Derived-From",
   501                      "Destination",
   502                      "Differential-ID",
   503                      "Digest",
   504                      "ETag",
   505                      "Expect",
   506                      "Expires",
   507                      "Ext",
   508                      "From",
   509                      "GET",
   510                      "GetProfile",
   511                      "HEAD",
   512                      "HTTP-date",
   513                      "Host",
   514                      "IM",
   515                      "If",
   516                      "If-Match",
   517                      "If-Modified-Since",
   518                      "If-None-Match",
   519                      "If-Range",
   520                      "If-Unmodified-Since",
   521                      "Keep-Alive",
   522                      "Label",
   523                      "Last-Event-ID",
   524                      "Last-Modified",
   525                      "Link",
   526                      "Location",
   527                      "Lock-Token",
   528                      "MIME-Version",
   529                      "Man",
   530                      "Max-Forwards",
   531                      "Media-Range",
   532                      "Message-ID",
   533                      "Meter",
   534                      "Negotiate",
   535                      "Non-Compliance",
   536                      "OPTION",
   537                      "OPTIONS",
   538                      "OWS",
   539                      "Opt",
   540                      "Optional",
   541                      "Ordering-Type",
   542                      "Origin",
   543                      "Overwrite",
   544                      "P3P",
   545                      "PEP",
   546                      "PICS-Label",
   547                      "POST",
   548                      "PUT",
   549                      "Pep-Info",
   550                      "Permanent",
   551                      "Position",
   552                      "Pragma",
   553                      "ProfileObject",
   554                      "Protocol",
   555                      "Protocol-Query",
   556                      "Protocol-Request",
   557                      "Proxy-Authenticate",
   558                      "Proxy-Authentication-Info",
   559                      "Proxy-Authorization",
   560                      "Proxy-Features",
   561                      "Proxy-Instruction",
   562                      "Public",
   563                      "RWS",
   564                      "Range",
   565                      "Referer",
   566                      "Refresh",
   567                      "Resolution-Hint",
   568                      "Resolver-Location",
   569                      "Retry-After",
   570                      "Safe",
   571                      "Sec-Websocket-Extensions",
   572                      "Sec-Websocket-Key",
   573                      "Sec-Websocket-Origin",
   574                      "Sec-Websocket-Protocol",
   575                      "Sec-Websocket-Version",
   576                      "Security-Scheme",
   577                      "Server",
   578                      "Set-Cookie",
   579                      "Set-Cookie2",
   580                      "SetProfile",
   581                      "SoapAction",
   582                      "Status",
   583                      "Status-URI",
   584                      "Strict-Transport-Security",
   585                      "SubOK",
   586                      "Subst",
   587                      "Surrogate-Capability",
   588                      "Surrogate-Control",
   589                      "TCN",
   590                      "TE",
   591                      "TRACE",
   592                      "Timeout",
   593                      "Title",
   594                      "Trailer",
   595                      "Transfer-Encoding",
   596                      "UA-Color",
   597                      "UA-Media",
   598                      "UA-Pixels",
   599                      "UA-Resolution",
   600                      "UA-Windowpixels",
   601                      "URI",
   602                      "Upgrade",
   603                      "User-Agent",
   604                      "Variant-Vary",
   605                      "Vary",
   606                      "Version",
   607                      "Via",
   608                      "Viewport-Width",
   609                      "WWW-Authenticate",
   610                      "Want-Digest",
   611                      "Warning",
   612                      "Width",
   613                      "X-Content-Duration",
   614                      "X-Content-Security-Policy",
   615                      "X-Content-Type-Options",
   616                      "X-CustomHeader",
   617                      "X-DNSPrefetch-Control",
   618                      "X-Forwarded-For",
   619                      "X-Forwarded-Port",
   620                      "X-Forwarded-Proto",
   621                      "X-Frame-Options",
   622                      "X-Modified",
   623                      "X-OTHER",
   624                      "X-PING",
   625                      "X-PINGOTHER",
   626                      "X-Powered-By",
   627                      "X-Requested-With"
   628                  ],
   629                  "exposed_headers" : [
   630                      "X-Debug-Token",
   631                      "X-Debug-Token-Link"
   632                  ]
   633              }
   634          },
   635          {
   636              "name" : "rate_limit",
   637              "enabled" : false,
   638              "config" : {
   639                  "limit" : "50-S",
   640                  "policy" : "local"
   641              }
   642          },
   643          {
   644              "name" : "oauth2",
   645              "enabled" : true,
   646              "config" : {
   647                  "server_name" : "live oauth server"
   648              }
   649          },
   650          {
   651              "name" : "compression",
   652              "enabled" : false
   653          }
   654      ]
   655  }`
   656  	def3 = `{
   657      "name" : "sku-mapper",
   658      "active" : true,
   659      "proxy" : {
   660          "preserve_host" : false,
   661          "listen_path" : "/scm/recipes/*",
   662          "upstreams" : {
   663              "balancing" : "roundrobin",
   664              "targets" : [
   665                  {
   666                      "target" : "http://sku-mapper.live-k8s.hellofresh.io/recipes",
   667                      "weight" : 50
   668                  }
   669              ]
   670          },
   671          "insecure_skip_verify" : false,
   672          "strip_path" : true,
   673          "append_path" : false,
   674          "enable_load_balancing" : false,
   675          "methods" : [
   676              "ALL"
   677          ],
   678          "hosts" : []
   679      },
   680      "plugins" : [
   681          {
   682              "name" : "cors",
   683              "enabled" : true,
   684              "config" : {
   685                  "request_headers" : [
   686                      "Accept",
   687                      "Accept-CH",
   688                      "Accept-Charset",
   689                      "Accept-Datetime",
   690                      "Accept-Encoding",
   691                      "Accept-Ext",
   692                      "Accept-Features",
   693                      "Accept-Language",
   694                      "Accept-Params",
   695                      "Accept-Ranges",
   696                      "Access-Control-Allow-Credentials",
   697                      "Access-Control-Allow-Headers",
   698                      "Access-Control-Allow-Methods",
   699                      "Access-Control-Allow-Origin",
   700                      "Access-Control-Expose-Headers",
   701                      "Access-Control-Max-Age",
   702                      "Access-Control-Request-Headers",
   703                      "Access-Control-Request-Method",
   704                      "Age",
   705                      "Allow",
   706                      "Alternates",
   707                      "Authentication-Info",
   708                      "Authorization",
   709                      "C-Ext",
   710                      "C-Man",
   711                      "C-Opt",
   712                      "C-PEP",
   713                      "C-PEP-Info",
   714                      "CONNECT",
   715                      "Cache-Control",
   716                      "Compliance",
   717                      "Connection",
   718                      "Content-Base",
   719                      "Content-Disposition",
   720                      "Content-Encoding",
   721                      "Content-ID",
   722                      "Content-Language",
   723                      "Content-Length",
   724                      "Content-Location",
   725                      "Content-MD5",
   726                      "Content-Range",
   727                      "Content-Script-Type",
   728                      "Content-Security-Policy",
   729                      "Content-Style-Type",
   730                      "Content-Transfer-Encoding",
   731                      "Content-Type",
   732                      "Content-Version",
   733                      "Cookie",
   734                      "Cost",
   735                      "DAV",
   736                      "DELETE",
   737                      "DNT",
   738                      "DPR",
   739                      "Date",
   740                      "Default-Style",
   741                      "Delta-Base",
   742                      "Depth",
   743                      "Derived-From",
   744                      "Destination",
   745                      "Differential-ID",
   746                      "Digest",
   747                      "ETag",
   748                      "Expect",
   749                      "Expires",
   750                      "Ext",
   751                      "From",
   752                      "GET",
   753                      "GetProfile",
   754                      "HEAD",
   755                      "HTTP-date",
   756                      "Host",
   757                      "IM",
   758                      "If",
   759                      "If-Match",
   760                      "If-Modified-Since",
   761                      "If-None-Match",
   762                      "If-Range",
   763                      "If-Unmodified-Since",
   764                      "Keep-Alive",
   765                      "Label",
   766                      "Last-Event-ID",
   767                      "Last-Modified",
   768                      "Link",
   769                      "Location",
   770                      "Lock-Token",
   771                      "MIME-Version",
   772                      "Man",
   773                      "Max-Forwards",
   774                      "Media-Range",
   775                      "Message-ID",
   776                      "Meter",
   777                      "Negotiate",
   778                      "Non-Compliance",
   779                      "OPTION",
   780                      "OPTIONS",
   781                      "OWS",
   782                      "Opt",
   783                      "Optional",
   784                      "Ordering-Type",
   785                      "Origin",
   786                      "Overwrite",
   787                      "P3P",
   788                      "PEP",
   789                      "PICS-Label",
   790                      "POST",
   791                      "PUT",
   792                      "Pep-Info",
   793                      "Permanent",
   794                      "Position",
   795                      "Pragma",
   796                      "ProfileObject",
   797                      "Protocol",
   798                      "Protocol-Query",
   799                      "Protocol-Request",
   800                      "Proxy-Authenticate",
   801                      "Proxy-Authentication-Info",
   802                      "Proxy-Authorization",
   803                      "Proxy-Features",
   804                      "Proxy-Instruction",
   805                      "Public",
   806                      "RWS",
   807                      "Range",
   808                      "Referer",
   809                      "Refresh",
   810                      "Resolution-Hint",
   811                      "Resolver-Location",
   812                      "Retry-After",
   813                      "Safe",
   814                      "Sec-Websocket-Extensions",
   815                      "Sec-Websocket-Key",
   816                      "Sec-Websocket-Origin",
   817                      "Sec-Websocket-Protocol",
   818                      "Sec-Websocket-Version",
   819                      "Security-Scheme",
   820                      "Server",
   821                      "Set-Cookie",
   822                      "Set-Cookie2",
   823                      "SetProfile",
   824                      "SoapAction",
   825                      "Status",
   826                      "Status-URI",
   827                      "Strict-Transport-Security",
   828                      "SubOK",
   829                      "Subst",
   830                      "Surrogate-Capability",
   831                      "Surrogate-Control",
   832                      "TCN",
   833                      "TE",
   834                      "TRACE",
   835                      "Timeout",
   836                      "Title",
   837                      "Trailer",
   838                      "Transfer-Encoding",
   839                      "UA-Color",
   840                      "UA-Media",
   841                      "UA-Pixels",
   842                      "UA-Resolution",
   843                      "UA-Windowpixels",
   844                      "URI",
   845                      "Upgrade",
   846                      "User-Agent",
   847                      "Variant-Vary",
   848                      "Vary",
   849                      "Version",
   850                      "Via",
   851                      "Viewport-Width",
   852                      "WWW-Authenticate",
   853                      "Want-Digest",
   854                      "Warning",
   855                      "Width",
   856                      "X-Content-Duration",
   857                      "X-Content-Security-Policy",
   858                      "X-Content-Type-Options",
   859                      "X-CustomHeader",
   860                      "X-DNSPrefetch-Control",
   861                      "X-Forwarded-For",
   862                      "X-Forwarded-Port",
   863                      "X-Forwarded-Proto",
   864                      "X-Frame-Options",
   865                      "X-Modified",
   866                      "X-OTHER",
   867                      "X-PING",
   868                      "X-PINGOTHER",
   869                      "X-Powered-By",
   870                      "X-Requested-With"
   871                  ],
   872                  "domains" : [
   873                      "*"
   874                  ],
   875                  "exposed_headers" : [
   876                      "X-Debug-Token",
   877                      "X-Debug-Token-Link"
   878                  ],
   879                  "methods" : [
   880                      "CONNECT",
   881                      "DEBUG",
   882                      "DELETE",
   883                      "DONE",
   884                      "GET",
   885                      "HEAD",
   886                      "HTTP",
   887                      "HTTP/0.9",
   888                      "HTTP/1.0",
   889                      "HTTP/1.1",
   890                      "HTTP/2",
   891                      "OPTIONS",
   892                      "ORIGIN",
   893                      "ORIGINS",
   894                      "PATCH",
   895                      "POST",
   896                      "PUT",
   897                      "QUIC",
   898                      "REST",
   899                      "SESSION",
   900                      "SHOULD",
   901                      "SPDY",
   902                      "TRACE",
   903                      "TRACK"
   904                  ]
   905              }
   906          },
   907          {
   908              "name" : "rate_limit",
   909              "enabled" : false,
   910              "config" : {
   911                  "limit" : "50-S",
   912                  "policy" : "local"
   913              }
   914          },
   915          {
   916              "name" : "oauth2",
   917              "enabled" : true,
   918              "config" : {
   919                  "server_name" : "live oauth server"
   920              }
   921          },
   922          {
   923              "name" : "compression",
   924              "enabled" : false,
   925              "config" : {}
   926          }
   927      ],
   928      "health_check" : {
   929          "url" : "",
   930          "timeout" : 0
   931      }
   932  }`
   933  	def4 = `{
   934      "name" : "Bacchus-wine-service",
   935      "active" : true,
   936      "proxy" : {
   937          "preserve_host" : false,
   938          "listen_path" : "/wineclub/*",
   939          "upstreams" : {
   940              "balancing" : "roundrobin",
   941              "targets" : [
   942                  {
   943                      "target" : "http://bacchus-service.staging-k8s.hellofresh.io",
   944                      "weight" : 0
   945                  }
   946              ]
   947          },
   948          "insecure_skip_verify" : false,
   949          "strip_path" : true,
   950          "append_path" : false,
   951          "enable_load_balancing" : false,
   952          "methods" : [
   953              "ALL"
   954          ],
   955          "hosts" : []
   956      },
   957      "plugins" : [
   958          {
   959              "name" : "cors",
   960              "enabled" : true,
   961              "config" : {
   962                  "domains" : [
   963                      "*"
   964                  ],
   965                  "exposed_headers" : [
   966                      "X-Debug-Token",
   967                      "X-Debug-Token-Link"
   968                  ],
   969                  "methods" : [
   970                      "CONNECT",
   971                      "DEBUG",
   972                      "DELETE",
   973                      "DONE",
   974                      "GET",
   975                      "HEAD",
   976                      "HTTP",
   977                      "HTTP/0.9",
   978                      "HTTP/1.0",
   979                      "HTTP/1.1",
   980                      "HTTP/2",
   981                      "OPTIONS",
   982                      "ORIGIN",
   983                      "ORIGINS",
   984                      "PATCH",
   985                      "POST",
   986                      "PUT",
   987                      "QUIC",
   988                      "REST",
   989                      "SESSION",
   990                      "SHOULD",
   991                      "SPDY",
   992                      "TRACE",
   993                      "TRACK"
   994                  ],
   995                  "request_headers" : [
   996                      "Accept",
   997                      "Accept-CH",
   998                      "Accept-Charset",
   999                      "Accept-Datetime",
  1000                      "Accept-Encoding",
  1001                      "Accept-Ext",
  1002                      "Accept-Features",
  1003                      "Accept-Language",
  1004                      "Accept-Params",
  1005                      "Accept-Ranges",
  1006                      "Access-Control-Allow-Credentials",
  1007                      "Access-Control-Allow-Headers",
  1008                      "Access-Control-Allow-Methods",
  1009                      "Access-Control-Allow-Origin",
  1010                      "Access-Control-Expose-Headers",
  1011                      "Access-Control-Max-Age",
  1012                      "Access-Control-Request-Headers",
  1013                      "Access-Control-Request-Method",
  1014                      "Age",
  1015                      "Allow",
  1016                      "Alternates",
  1017                      "Authentication-Info",
  1018                      "Authorization",
  1019                      "C-Ext",
  1020                      "C-Man",
  1021                      "C-Opt",
  1022                      "C-PEP",
  1023                      "C-PEP-Info",
  1024                      "CONNECT",
  1025                      "Cache-Control",
  1026                      "Compliance",
  1027                      "Connection",
  1028                      "Content-Base",
  1029                      "Content-Disposition",
  1030                      "Content-Encoding",
  1031                      "Content-ID",
  1032                      "Content-Language",
  1033                      "Content-Length",
  1034                      "Content-Location",
  1035                      "Content-MD5",
  1036                      "Content-Range",
  1037                      "Content-Script-Type",
  1038                      "Content-Security-Policy",
  1039                      "Content-Style-Type",
  1040                      "Content-Transfer-Encoding",
  1041                      "Content-Type",
  1042                      "Content-Version",
  1043                      "Cookie",
  1044                      "Cost",
  1045                      "DAV",
  1046                      "DELETE",
  1047                      "DNT",
  1048                      "DPR",
  1049                      "Date",
  1050                      "Default-Style",
  1051                      "Delta-Base",
  1052                      "Depth",
  1053                      "Derived-From",
  1054                      "Destination",
  1055                      "Differential-ID",
  1056                      "Digest",
  1057                      "ETag",
  1058                      "Expect",
  1059                      "Expires",
  1060                      "Ext",
  1061                      "From",
  1062                      "GET",
  1063                      "GetProfile",
  1064                      "HEAD",
  1065                      "HTTP-date",
  1066                      "Host",
  1067                      "IM",
  1068                      "If",
  1069                      "If-Match",
  1070                      "If-Modified-Since",
  1071                      "If-None-Match",
  1072                      "If-Range",
  1073                      "If-Unmodified-Since",
  1074                      "Keep-Alive",
  1075                      "Label",
  1076                      "Last-Event-ID",
  1077                      "Last-Modified",
  1078                      "Link",
  1079                      "Location",
  1080                      "Lock-Token",
  1081                      "MIME-Version",
  1082                      "Man",
  1083                      "Max-Forwards",
  1084                      "Media-Range",
  1085                      "Message-ID",
  1086                      "Meter",
  1087                      "Negotiate",
  1088                      "Non-Compliance",
  1089                      "OPTION",
  1090                      "OPTIONS",
  1091                      "OWS",
  1092                      "Opt",
  1093                      "Optional",
  1094                      "Ordering-Type",
  1095                      "Origin",
  1096                      "Overwrite",
  1097                      "P3P",
  1098                      "PEP",
  1099                      "PICS-Label",
  1100                      "POST",
  1101                      "PUT",
  1102                      "Pep-Info",
  1103                      "Permanent",
  1104                      "Position",
  1105                      "Pragma",
  1106                      "ProfileObject",
  1107                      "Protocol",
  1108                      "Protocol-Query",
  1109                      "Protocol-Request",
  1110                      "Proxy-Authenticate",
  1111                      "Proxy-Authentication-Info",
  1112                      "Proxy-Authorization",
  1113                      "Proxy-Features",
  1114                      "Proxy-Instruction",
  1115                      "Public",
  1116                      "RWS",
  1117                      "Range",
  1118                      "Referer",
  1119                      "Refresh",
  1120                      "Resolution-Hint",
  1121                      "Resolver-Location",
  1122                      "Retry-After",
  1123                      "Safe",
  1124                      "Sec-Websocket-Extensions",
  1125                      "Sec-Websocket-Key",
  1126                      "Sec-Websocket-Origin",
  1127                      "Sec-Websocket-Protocol",
  1128                      "Sec-Websocket-Version",
  1129                      "Security-Scheme",
  1130                      "Server",
  1131                      "Set-Cookie",
  1132                      "Set-Cookie2",
  1133                      "SetProfile",
  1134                      "SoapAction",
  1135                      "Status",
  1136                      "Status-URI",
  1137                      "Strict-Transport-Security",
  1138                      "SubOK",
  1139                      "Subst",
  1140                      "Surrogate-Capability",
  1141                      "Surrogate-Control",
  1142                      "TCN",
  1143                      "TE",
  1144                      "TRACE",
  1145                      "Timeout",
  1146                      "Title",
  1147                      "Trailer",
  1148                      "Transfer-Encoding",
  1149                      "UA-Color",
  1150                      "UA-Media",
  1151                      "UA-Pixels",
  1152                      "UA-Resolution",
  1153                      "UA-Windowpixels",
  1154                      "URI",
  1155                      "Upgrade",
  1156                      "User-Agent",
  1157                      "Variant-Vary",
  1158                      "Vary",
  1159                      "Version",
  1160                      "Via",
  1161                      "Viewport-Width",
  1162                      "WWW-Authenticate",
  1163                      "Want-Digest",
  1164                      "Warning",
  1165                      "Width",
  1166                      "X-Content-Duration",
  1167                      "X-Content-Security-Policy",
  1168                      "X-Content-Type-Options",
  1169                      "X-CustomHeader",
  1170                      "X-DNSPrefetch-Control",
  1171                      "X-Forwarded-For",
  1172                      "X-Forwarded-Port",
  1173                      "X-Forwarded-Proto",
  1174                      "X-Frame-Options",
  1175                      "X-Modified",
  1176                      "X-OTHER",
  1177                      "X-PING",
  1178                      "X-PINGOTHER",
  1179                      "X-Powered-By",
  1180                      "X-Requested-With"
  1181                  ]
  1182              }
  1183          },
  1184          {
  1185              "name" : "rate_limit",
  1186              "enabled" : false,
  1187              "config" : {
  1188                  "limit" : "50-S",
  1189                  "policy" : "local"
  1190              }
  1191          },
  1192          {
  1193              "name" : "oauth2",
  1194              "enabled" : true,
  1195              "config" : {
  1196                  "server_name" : "live oauth server"
  1197              }
  1198          },
  1199          {
  1200              "name" : "compression",
  1201              "enabled" : false,
  1202              "config" : {}
  1203          }
  1204      ],
  1205      "health_check" : {
  1206          "url" : "",
  1207          "timeout" : 0
  1208      }
  1209  }`
  1210  )