{"id":16767857,"url":"https://github.com/eolinker/goku-plugin-extra_params","last_synced_at":"2025-03-16T13:14:22.118Z","repository":{"id":103579720,"uuid":"208740737","full_name":"eolinker/Goku-plugin-extra_params","owner":"eolinker","description":"GOKU API GATEWAY 官方插件：额外参数","archived":false,"fork":false,"pushed_at":"2019-09-19T02:28:15.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T00:44:00.529Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eolinker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-16T07:47:34.000Z","updated_at":"2023-07-25T14:29:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"7165ff6b-ce8d-4a7a-8854-7391da863600","html_url":"https://github.com/eolinker/Goku-plugin-extra_params","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eolinker%2FGoku-plugin-extra_params","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eolinker%2FGoku-plugin-extra_params/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eolinker%2FGoku-plugin-extra_params/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eolinker%2FGoku-plugin-extra_params/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eolinker","download_url":"https://codeload.github.com/eolinker/Goku-plugin-extra_params/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243871912,"owners_count":20361380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T06:10:09.322Z","updated_at":"2025-03-16T13:14:22.110Z","avatar_url":"https://github.com/eolinker.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Goku Plugin：Extra Params\n\n| 插件名称  | 文件名.so |  插件类型  | 错误处理方式 | 作用范围 |  优先级  |\n| ------------ | ------------ | ------------ | ------------ | ------------ | ------------ |\n| 额外参数  | goku-extra_params | 访问策略 | 继续后续操作 | 转发前  |  800  |\n\n开启该插件后，不需要用户传某些参数值，网关会在转发时自动带上这些参数，支持header、body、query参数。\n额外参数仅支持 **表单** 类型与 **json** 类型：\n* formdata的参数值须为string类型，头部补充Conent-Type:x-www-form-urlencoded。\n* 若额外参数是json类型，需在头部补充Content-Type:application/json。\n* 参数类型为表单时支持同名参数。\n\n# 目录\n- [编译教程](#编译教程 \"编译教程\")\n- [安装教程](#安装教程 \"安装教程\")\n- [使用教程](#使用教程 \"使用教程\")\n- [更新日志](#更新日志 \"更新日志\")\n\n# 编译教程\n\n#### 环境要求\n* 系统：基于 Linux 内核（2.6.23+）的系统，CentOS、RedHat 等均可；\n\n* golang版本号：12.x及其以上\n\n* 环境变量设置：\n\t* GO111MODULE：on\n\t\n\t* GOPROXY：https://goproxy.io\n\n\n#### 编译步骤\n\n1.clone项目\n\n2.进入项目文件夹，执行**build.sh**\n```\ncd goku-extra_params \u0026\u0026 chmod +x build.sh \u0026\u0026 ./build.sh\n```\n\n###### 注：build.sh为通用的插件编译脚本，自定义插件时可以拷贝直接使用。\n\n3.执行第2步将会生成文件： **{插件名}.so**\n\n将该文件上传到**节点服务器运行目录**下的**plugin**文件夹，然后在控制台安装插件即可使用。\n\n# 安装教程\n前往 Goku API Gateway 官方网站查看：[插件安装教程](url \"https://help.eolinker.com/#/tutorial/?groupID=c-341\u0026productID=19\")\n\n# 使用教程\n\n#### 配置页面\n\n进入控制台 \u003e\u003e 策略管理 \u003e\u003e 某策略 \u003e\u003e API插件 \u003e\u003e 额外参数插件：\n\n![](http://data.eolinker.com/course/v6x1ZXl19cf9a61e29c11c04ad602f865135e58ba663c2b)\n\n#### 配置参数\n\n| 参数名 | 说明   | \n| ------------ | ------------ |  \n|  params |额外参数列表 | \n| paramName  | 参数名 |\n| paramPosition  | 参数位置 |  \n| paramValue  | 参数值 | \n| paramConflictSolution  |  参数冲突时的处理方式 [origin/convert/error] |\n\n参数冲突说明：\n额外参数插件配置了参数A的值，但是直接请求时也传了参数A，此时为参数出现冲突，参数A实际上会接收两个参数值。\n* convert：参数出现冲突时，取映射后的参数，即配置的值\n* origin：参数出现冲突时，取映射前的参数，即实际传的值\n* error：请求时报错，\"param_name\"has a conflict.\n\n若paramConflictSolution为空，视为使用默认值convert。\n\n#### 配置示例\n```\n{\n    \"params\": [\n        {\n            \"paramName\": \"test\",\n            \"paramPosition\": \"header\",\n            \"paramValue\": \"extra_param\",\n            \"paramConflictSolution\":\"convert\"\n        }\n    ]\n}\n```\n\n#### API请求参数\n\n| 参数名 | 说明  | 必填  |   值可能性   |  参数位置 |\n| :----------- | :----------- | :----------- | :----------- | :----------- |\n|  Strategy-Id | 策略ID  | 是 |   |  header  | \n|  Content-Type | 数据类型  | 是 | x-www-form-urlencoded 或 application/json   |  header  | \n\n若该 test 参数为表单参数，则请求头部填写 Conent-Type:x-www-form-urlencoded。\n若该 test 参数为Json参数，则请求头部需加 Conent-Type:application/json。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feolinker%2Fgoku-plugin-extra_params","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feolinker%2Fgoku-plugin-extra_params","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feolinker%2Fgoku-plugin-extra_params/lists"}