Comments (6)
This is not very common. You can implement it with custom code.
For example:
for (let a in val) {
if (val[a].name === 'Cookie') {
val[a].value += ';myaddedcookie=abc';
return;
}
}
// If this request has not Cookie, add it
val.push({
"name": "Cookie",
"value": "myaddedcookie=abc"
});
from headereditor.
You can use regular expression. Documention: MDN. For example:
val[a].value = val[a].value.replace(/ball=(\w+)/, ''); // will remove ball=[english words], such as ball=words
val[a].value = val[a].value.replace(/ball=(\d+)/, ''); // will remove ball=[numbers], such as ball=12345
val[a].value = val[a].value.replace(/ball=([a-zA-Z0-9]+)/, ''); // will remove ball=[english words or numbers], such as ball=1a2b3qq135
from headereditor.
Thanks, that works for me!
On a somewhat related question, do you know of a custom code that is able to remove a specific header value, example: remove value 'ball' from Cookie: ball=1&cat=1 so it then becomes Cookie: cat=1
I messed around with some JS code to do this but wasn't able to get one working since my knowledge of JS is weak
from headereditor.
You can use replace
function. Example:
for (let a in val) {
if (val[a].name === 'Cookie') {
val[a].value = val[a].value.replace('ball=value', '');
break;
}
}
If you want to learn more about Javascript, you can visit MDN
from headereditor.
Thanks again and also for the link, will look into it.
If I see correctly, the code would work only if the value in ball=value is constant, but what if the value is randomly generated?
from headereditor.
Interesting, I'll look more into regular expressions. Thank you!
from headereditor.
Related Issues (20)
- [Question] 请问设置里的“规则对header editor无效”是什么意思? HOT 1
- [Question] Help making a rule HOT 3
- [Question] 能否通过检测窗口大小来设置浏览器 UA? HOT 13
- 第三方规则:复杂跨域
- [Question] 可以重定向 js 文件吗 HOT 2
- [BUG]webWorkers发起的请求无法拦截修改请求头 HOT 1
- [Question] 如何加载JS小书签?问题 2.0 版本 HOT 6
- [BUG] Redirector rule converter website broken HOT 1
- [Question]关于网址的重定向 HOT 2
- { "request": [ { "enable": true, "name": "bing-cn-to-www", "ruleType": "redirect", "matchType": "prefix", "pattern": "https://cn.bing.com", "exclude": "", "group": "bing-redirect", "isFunction": false, "action": "redirect", "to": "https://www.bing.com" } ], "sendHeader": [ { "enable": true, "name": "bing", "ruleType": "modifySendHeader", "matchType": "regexp", "pattern": "^http(s?)://www\\.bing\\.com/(.*)", "exclude": "", "group": "bing-direct", "isFunction": false, "action": { "name": "x-forwarded-for", "value": "8.8.8.8" } } ], "receiveHeader": [], "receiveBody": [] }
- [Feature Request] Support sync to WebDAV
- 123
- [Question]Edge浏览器不支持HE的自定义函数? HOT 1
- [Question]why did Header Editor for edge on macos not work HOT 4
- 1
- head editor
- [Question] How to delete a header in a custom function
- bing
- canshu
- [BUG] 在别的插件中显示sina-img图片返回status 403 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from headereditor.