Comments (2)
HttpClient
를 가지는 생성자 오버로드로 해결하면 어떨까요? 물론 이때는 HttpClient
를 독점적으로 소유하고 있지 않으므로 Dipose
하는 건 맞지 않겠네요.
private readonly bool ownsExclusively;
public IamportHttpClient(IOptions<IamportHttpClientOptions> optionsAccessor)
:this(optionsAccessor, new HttpClient())
{
this.ownsExclusively = true;
}
public IamportHttpClient(IOptions<IamportHttpClientOptions> optionsAccessor, HttpClient httpClient)
{
this.HttpClient = httpClient;
this.HttpClient.BaseAddress = new Uri(options.BaseUrl, UriKind.Absolute);
this.HttpClient.DefaultRequestHeaders.Connection.Add("keep-alive");
...
}
public HttpClient HttpClient { get; }
public void Dispose()
{
if(this.ownsExclusively)
this.httpClient
}
from iamport-rest-client-net.
@jwChung 의견감사합니다.
곰곰히 생각해봤는데 현재 클라이언트가 인증된 상태인지 여부만 별도로 노출하는 것이 좋을 것 같습니다. IamportHttpClient
가 IsAuthorized
속성정도로 제공하면 되겠지요.
HttpClient
를 직접 노출하는 것은 사용자코드에서 의도하지 않은 변경을 가할 수 있어서 피하고 싶습니다.
from iamport-rest-client-net.
Related Issues (20)
- ASP.NET Core 1.0 샘플 수정
- Sample에서 중복된 TransactionId를 사용하지 않도록 처리
- 결제PG사, 결제 수단 등은 enum이 아닌 string이어야 합니다.
- Payment 모델링이 잘못됨 HOT 1
- subscribe/payments/again 호출시 불필요한 필드 삭제 HOT 1
- VS 2017, C#7, .NET Core 1.1.1 대응 HOT 1
- customer_uid는 URL Encode해야 합니다.
- AMEX 카드 자릿수는 15입니다.
- 샘플의 gateway.cshtml에 버그
- Install 도 안되고 vs 2015에서 열리지 않습니다. HOT 13
- .NET Standard 2.0 대응
- Update NuGet metadata
- Take ownership from OpenBapul to gongdo
- 은행코드의 길이 제한 문제 HOT 1
- Update vulnerable package Microsoft.AspNetCore.All
- Refine CI process
- Refine PaymentGateway enumerating
- [토론] 개발 방향
- Fix CI bug
- DLL 참조 에러 HOT 5
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 iamport-rest-client-net.