Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
vip.justlive:easy-http
Advanced tools
easy to contact http rest api
@RequestMapping
、@GetMapping
、@PostMapping
、@RequestParam
、RequestHeader
、PathVariable
等注解扩展创建Maven
项目
<dependency>
<groupId>vip.justlive</groupId>
<artifactId>easy-http</artifactId>
<version>${lastVersion}</version>
</dependency>
或Gradle
compile 'vip.justlive:easy-http:$lastVersion'
// 创建接口
@HttpClient
@RequestMapping("https://api.github.com")
public interface GithubApi {
@RequestMapping(method = RequestMethod.GET)
String root();
@GetMapping("/repos/{owner}/{repo}")
Repository repos(@PathVariable String owner, @PathVariable String repo);
@Data
class Repository {
private Long id;
private String name;
private int forks;
private int watchers;
}
}
// 使用${xx}获取配置
@HttpClient
@RequestMapping("${thirdpart.api.url}")
public interface ThirdpartApi {
@PostMapping("/api/token")
RespVo<AccessToken> token(@RequestParam String appKey, @RequestParam String appSecret);
@PostMapping("/api/account")
RespVo<Account> account(@RequestHeader String accessToken, @RequestBody Account account);
@Data
@Accessors(chain = true)
class AccessToken {
private String accessToken;
private Long expiresIn;
}
@Data
@Accessors(chain = true)
class Account {
private String name;
private BigDecimal balance;
}
}
// 增加扫描(默认为当前类所处包)
@HttpClientScan("com.xxx")
@Configuration
public class HttpClientAutoConfiguration {
}
// 使用
@Slf4j
@Component
public class Demo {
@Autowired
private GithubApi githubApi;
@Autowired
private ThirdpartApi thirdpartApi;
@PostConstruct
private void init() {
String result = githubApi.root();
log.info("githubApi root {}", result);
Repository repository = githubApi.repos("justlive1", "easy-http");
log.info("githubApi repos {}", repository);
AccessToken token = thirdpartApi.token("key", "secret").getData();
log.info("thirdpartApi token {}", token);
Account account = new Account().setName("aa").setBalance(new BigDecimal("12.3"));
account = thirdpartApi.account(token.getAccessToken(), account).getData();
log.info("thirdpartApi account {}", account);
}
}
FAQs
easy to contact http rest api
We found that vip.justlive:easy-http demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.